public override void Update() { base.Update(); if (animation != null) { if (animation.Finished) animation = null; else { animation.Bounds.Center = this.Center + offset; animation.Update(); } } }
public Resource(Zone initialBounds) : base(initialBounds) { //initialize element array elements = new int[88]; for (int i = 0; i < Elements.Length; i++) { elements[i] = 0; } //initialize sprites Idle = new Animation("WhitePixel"); BeingMined = new Animation("WhitePixel"); Consumed = new Animation("WhitePixel"); }
public Tree(Point initialPosition) : base(new Zone(initialPosition.X, initialPosition.Y, treeSize.X, treeSize.Y)) { //set sprite(s) DrawBorder = true; //set default resources for tree //todo: randomize values somewhat AddElement(1, 20); AddElement(2, 12); AddElement(3, 13); AddElement(4, 2); AddElement(5, 20); //set animations Idle = new Animation("Tree2"); BeingMined = new Animation("Tree2"); Consumed = new Animation("Tree2"); Offset = new Point(0, -30); }
public Unit(Player owner, Zone initialBounds) : base(owner, initialBounds) { Idle = new Animation("WhitePixel"); Idle.Bounds.Width = this.Width; Idle.Bounds.Height = this.Height; Moving = new Animation("WhitePixel"); Moving.Bounds.Width = this.Width; Moving.Bounds.Height = this.Height; Attacking = new Animation("WhitePixel"); Attacking.Bounds.Width = this.Width; Attacking.Bounds.Height = this.Height; Dying = new Animation("WhitePixel"); Dying.Bounds.Width = this.Width; Dying.Bounds.Height = this.Height; }
protected void Play(Animation a) { if (animation != a) animation = a; }