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

Revision 7212, 1.0 KB checked in by sieerinn, 5 years ago (diff)

Pelaaja muutettu PlatformCharacteriksi? ja aikalaskuri lisätty

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, 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.