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

Revision 7209, 941 bytes checked in by sieerinn, 4 years ago (diff)

Pelaajille laitettu 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
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)
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        overlay.Animation.Start();
33        Add(overlay);
34    }
35}
Note: See TracBrowser for help on using the repository browser.