Line | |
---|
1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using System.Text; |
---|
5 | using Jypeli; |
---|
6 | |
---|
7 | public class Vaunu : Tuhoutuva |
---|
8 | { |
---|
9 | public bool OnkoRaiteilla { get; set; } |
---|
10 | |
---|
11 | List<Ase> Aseet = new List<Ase>(); |
---|
12 | |
---|
13 | public Vaunu(double width, double height, int elamat) |
---|
14 | : base(width, height, elamat) |
---|
15 | { |
---|
16 | this.Mass = 100; |
---|
17 | this.CanRotate = false; |
---|
18 | this.OnkoRaiteilla = true; |
---|
19 | this.IsUpdated = true; |
---|
20 | } |
---|
21 | |
---|
22 | public Vaunu(Image kuva, int elamat) |
---|
23 | : base(kuva, elamat) |
---|
24 | { |
---|
25 | this.Mass = 100; |
---|
26 | this.CanRotate = false; |
---|
27 | this.OnkoRaiteilla = true; |
---|
28 | this.IsUpdated = true; |
---|
29 | } |
---|
30 | |
---|
31 | public override void Update(Time time) |
---|
32 | { |
---|
33 | if (OnkoRaiteilla) |
---|
34 | { |
---|
35 | if (this.X != 0.0) |
---|
36 | this.X = 0.0; |
---|
37 | } |
---|
38 | for (int i = 0; i < Aseet.Count; i++) |
---|
39 | { |
---|
40 | Aseet[i].Angle = (WarTrain.Peli.Mouse.PositionOnWorld - Aseet[i].Position).Angle; |
---|
41 | } |
---|
42 | base.Update(time); |
---|
43 | } |
---|
44 | |
---|
45 | public void LisaaAse(Ase ase, Vector relativePosition) |
---|
46 | { |
---|
47 | Aseet.Add(ase); |
---|
48 | this.Add(ase); |
---|
49 | ase.Position = relativePosition; |
---|
50 | } |
---|
51 | |
---|
52 | public void Ammu() |
---|
53 | { |
---|
54 | for (int i = 0; i < Aseet.Count; i++) |
---|
55 | { |
---|
56 | Aseet[i].Shoot(); |
---|
57 | } |
---|
58 | } |
---|
59 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.