Line | |
---|
1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using System.Text; |
---|
5 | using Jypeli; |
---|
6 | |
---|
7 | class Tile : PhysicsObject |
---|
8 | { |
---|
9 | private GameObject glow; |
---|
10 | |
---|
11 | public Tile(double width, double height, Vector position) : base(width, height) |
---|
12 | { |
---|
13 | this.Position = position; |
---|
14 | |
---|
15 | glow = new GameObject(width * 7, height * 7); |
---|
16 | glow.IsVisible = false; |
---|
17 | glow.Position = position; |
---|
18 | Game.Instance.Add(glow, 3); |
---|
19 | } |
---|
20 | |
---|
21 | public void SetColor(Image[] animation, Image glowImage, Color newColor, Action colorChanged) |
---|
22 | { |
---|
23 | var overlay = new GameObject(Width, Height); |
---|
24 | overlay.Animation = new Animation(animation); |
---|
25 | overlay.Animation.Played += () => |
---|
26 | { |
---|
27 | glow.IsVisible = true; |
---|
28 | glow.Image = glowImage; |
---|
29 | this.Color = newColor; |
---|
30 | overlay.Destroy(); |
---|
31 | |
---|
32 | if (colorChanged != null) |
---|
33 | { |
---|
34 | colorChanged(); |
---|
35 | } |
---|
36 | }; |
---|
37 | overlay.Animation.Start(); |
---|
38 | Add(overlay); |
---|
39 | } |
---|
40 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.