Exemplo n.º 1
0
 // constructor
 public Entity(string id, float x = 0, float y = 0, Program.GameObjectType type = Program.GameObjectType.Unknown)
 {
     this.Id         = id;
     this.Position   = new Vector(x, y);
     this.CanRemove  = false;
     this.ObjectType = Program.GameObjectType.Unknown;
     this.State      = 0;
     this.Tag        = null;
     this.CreateTime = Program.CurrentTime;
     this.RemoveTime = null;
     this.ObjectType = type;
     this.Visible    = true;
 }
Exemplo n.º 2
0
        // static method
        static public SpriteEntity CreateFromConfig(dynamic item)
        {
            string id = item.id;
            float  x  = item.x ?? 0;
            float  y  = item.y ?? 0;

            Bitmap bmp = Program.Sprites[(string)item.bmp];
            float  w   = item.width ?? bmp.Width;
            float  h   = item.height ?? bmp.Height;

            Program.GameObjectType type = ToGameObjectType(item.type);
            bool visible = item.visible ?? true;

            SpriteEntity se = new SpriteEntity(
                id, x, y, w, h, bmp, type
                );

            se.Visible = visible;

            return(se);
        }
Exemplo n.º 3
0
 public SpriteEntity(string id, float x, float y, Bitmap bmp, Program.GameObjectType type)
     : this(id, x, y, bmp.Width, bmp.Height, bmp, type)
 {
 }
Exemplo n.º 4
0
 public SpriteEntity(string id, float x, float y, float w, float h, Bitmap bmp, Program.GameObjectType type)
     : this(id, x, y, w, h, new Bitmap[] { bmp }, type)
 {
 }
Exemplo n.º 5
0
 public SpriteEntity(string id, float x, float y, Bitmap[] bitmaps, Program.GameObjectType type)
     : this(id, x, y, bitmaps[0].Width, bitmaps[0].Height, bitmaps, type)
 {
 }
Exemplo n.º 6
0
 // constructors
 public SpriteEntity(string id, float x, float y, float w, float h, Bitmap[] bitmaps, Program.GameObjectType type) : base(id, x, y, type)
 {
     this.Width                = w;
     this.Height               = h;
     this.Bitmaps              = bitmaps;
     this.SpriteIndex          = 0;
     this.SpriteUpdateInterval = 1;
 }