-
Notifications
You must be signed in to change notification settings - Fork 0
/
AVykreslitelnyObjekt.cs
40 lines (34 loc) · 1.08 KB
/
AVykreslitelnyObjekt.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
namespace PlanetAvoid
{
public abstract class AVykreslitelnyObjekt
{
public RectangleF Obdelnik; //pouziva se pro pozici objektu a kolizi objektu
protected Bitmap _sprite;
public virtual Bitmap Sprite
{
get
{
if (this._sprite != null && !this._statickySpriteVykreslen)
{
this.VykresliSprite(); //neodkazovat na this.Sprite z teto metody nebo dojde k zacykleni a SO!
}
return _sprite;
}
set { _sprite = value; }
}
protected bool _statickySpriteVykreslen = false;
/// <summary>
/// Neodkazovat na this.Sprite z teto metody nebo dojde k zacykleni a StackOverflow!
/// </summary>
public abstract void VykresliSprite();
public void Posun(float x, float y)
{
this.Obdelnik = new RectangleF(new PointF(x, y), this.Obdelnik.Size);
}
}
}