2 using System.Collections.Generic;
13 public static void Savuta(PhysicsGame peli, IPhysicsObject olio,
bool useShock =
false,
double kerroin = 10)
16 Smoke savu =
new Smoke();
17 savu.MaximumLifetime = TimeSpan.FromSeconds(3);
18 savu.Position = olio.Position;
19 peli.Add(savu); olio.Destroy();
21 Timer timer =
new Timer();
24 timer.Timeout += delegate()
37 public Syotava(PhysicsGame peli,
double w, Vector p,
string tunniste,
int elinaika)
41 this.Image = Game.LoadImage(tunniste);
42 this.Height = this.Width * this.Image.Height / this.Image.Width;
45 this.LifetimeLeft =
new TimeSpan(10000 * elinaika);
52 public Luu(PhysicsGame peli,
double w, Vector p)
53 : base(peli, w, p,
"luu", 1000)
62 public Juusto(PhysicsGame peli,
double w, Vector p)
63 : base(peli, w, p,
"juusto", 5000)
70 public class Elain : PhysicsObject
77 public Elain(PhysicsGame peli,
double w, Vector p,
string nimi,
string tunniste)
81 this.Image = Game.LoadImage(tunniste);
83 this.Height = this.Width * this.Image.Height / this.Image.Width;
85 Label label =
new Label(nimi);
91 public virtual void Liiku(Vector suunta)
96 bool nytVasen = suunta.X < 0;
97 if (nytVasen ^
vasen) this.MirrorImage();
108 public virtual void Syo(PhysicsObject kuka, PhysicsObject kenet)
111 this.Size +=
new Vector(10, 10);
119 public Koira(PhysicsGame peli,
double w, Vector p,
string nimi =
"")
120 : base(peli, w, p,
nimi,
"koira")
122 peli.AddCollisionHandler(
this,
"luu",
Syo);
128 Game.PlaySound(
"KoiranAani1");
135 public Kissa(PhysicsGame peli,
double w, Vector p,
string nimi =
"")
136 : base(peli, w, p,
nimi,
"kissa")
138 peli.AddCollisionHandler(
this,
"hiiri",
Syo);
143 Game.PlaySound(
"KissanAani01");
152 : base(peli, w, p,
"",
"hiiri")
154 this.LifetimeLeft =
new TimeSpan(0, 0, 0, 5);
155 peli.AddCollisionHandler(
this,
"juusto",
Syo);
156 this.Destroyed += delegate() {
new Luu(peli, Width * 0.8, Position); };
157 FollowerBrain brain =
new FollowerBrain(juusto);
161 public override void Syo(PhysicsObject kuka, PhysicsObject kenet)
163 base.Syo(kuka, kenet);
164 this.LifetimeLeft =
new TimeSpan(0, 0, 0, 15);
169 Game.PlaySound(
"Naps");