Line | |
---|
1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using System.Text; |
---|
5 | using Jypeli; |
---|
6 | |
---|
7 | /// <summary> |
---|
8 | /// PlatformCharacter, jolla on elämälaskuri. |
---|
9 | /// </summary> |
---|
10 | public class Elava : PlatformCharacter |
---|
11 | { |
---|
12 | public DoubleMeter Elamat { get; private set; } |
---|
13 | |
---|
14 | public event Action Kuoli; |
---|
15 | |
---|
16 | public Elava(double width, double height, double elamat) |
---|
17 | :base(width, height) |
---|
18 | { |
---|
19 | Elamat = new DoubleMeter(elamat, 0, elamat); |
---|
20 | Elamat.LowerLimit += Kuoli; |
---|
21 | } |
---|
22 | |
---|
23 | /// <summary> |
---|
24 | /// Vähennetään elämiä. Vain vähentämiseen (ts. maara > 0) |
---|
25 | /// </summary> |
---|
26 | /// <param name="maara"></param> |
---|
27 | public void Damagea(double maara) |
---|
28 | { |
---|
29 | if (maara > 0) return; |
---|
30 | |
---|
31 | this.Elamat.Value -= maara; |
---|
32 | } |
---|
33 | |
---|
34 | /// <summary> |
---|
35 | /// Palautetaan elämiä. Vain palauttamiseen (ts. maara > 0) |
---|
36 | /// </summary> |
---|
37 | /// <param name="maara"></param> |
---|
38 | public void Paranna(double maara) |
---|
39 | { |
---|
40 | if (maara < 0) return; |
---|
41 | |
---|
42 | this.Elamat.Value += maara; |
---|
43 | } |
---|
44 | |
---|
45 | /// <summary> |
---|
46 | /// Täyttää pelaajan elämät. |
---|
47 | /// </summary> |
---|
48 | public void ElamatTayteen() |
---|
49 | { |
---|
50 | this.Elamat.Value = this.Elamat.MaxValue; |
---|
51 | } |
---|
52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.