source: 2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/Tile.cs @ 7208

Revision 7208, 987 bytes checked in by sieerinn, 4 years ago (diff)

Tiili animaatiot

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