public override void Dispose() { this.target = null; this.entity_attack = null; base.Dispose(); }
public LavaEntity(ITile tile, Texture2D texture, Color color, bool isBlocked, float layerDepth, int damage, IEntity parent, IDefendable defender, Vector2 target) : base(tile) { this.destinationRectangle = new Rectangle { X = tile.Rectangle.Center.X, Y = tile.Rectangle.Center.Y, Height = texture.Height, Width = texture.Width }; this.enabled = true; this.isBlocked = isBlocked; this.texture = texture; this.color = Color.White; this.layerDepth = layerDepth; this.MoveRate = 5000; this.tile = tile; this.parent = parent; this.Damage = damage; this.target = target; this.defender = defender; this.Position = new Vector2(parent.Rectangle.Center.X, parent.Rectangle.Center.Y); this.IsFlying = true; this.isTileMovement = false; }
public int Attack(IDefendable defender) { this.isAttacking = true; this.color = Color.Red; return defender.Defend(this); }
/// <summary> /// Attacks the defender /// </summary> /// <param name="defender">Entity to be attacked</param> /// <returns>Damage done</returns> public int Attack(IDefendable defender) { //this.isAttacking = true; // controls state, should be fsm this.color = attack_color; // should be animation return defender.Defend(this); // the defender modifies its own HP using this entity's damage }
private Vector2 FindAngle(IDefendable target) { Vector2 enemy = target.Position; Vector2 direction = enemy - this.Position; direction.Normalize(); //direction = direction * 100; //return Vector2.Clamp(direction, Vector2.One * 0.001f, Vector2.One); ; return direction; }
public int Attack(IDefendable defender) { if (defender.IsNotNull()) { this.Angle = FindAngle(defender); //this.Rotation = this.Angle.ToRotation(); this.Rotation = 0; BulletEntity bullet = new BulletEntity ( this.Tile, this.Texture_Bullet, this.Color, false, this.layerDepth + 0.01f, this.Damage, this, this.Angle * 5 //Vector2.SmoothStep(this.Position, defender.Position, 0.01f) ); this.ChildrenEntities.Add(bullet); } return 0; }
public int Attack(IDefendable defender) { if (defender.IsNotNull()) { BeamEntity beam = new BeamEntity ( this.Tile, this.Texture_Beam, this.Color, false, this.layerDepth + 0.02f, this.Damage, this, defender, this.Angle ); this.ChildrenEntities.Add(beam); } return 0; }
public int Attack(IDefendable defender) { this.isAttacking = true; this.color = Color.Red; int result = defender.Defend(this); if (defender.HP <= 0) { this.kills++; this.Damage = this.Damage + kills; this.HP = 100; this.color = Color.Yellow; } return result; }
public int Attack(IDefendable defender) { if (defender.IsNotNull()) { LavaEntity lava = new LavaEntity ( this.Tile, this.Texture_Lava, this.Color, false, this.layerDepth + 0.02f, this.Damage, this, defender, this.Angle ); this.ChildrenEntities.Add(lava); } return 0; }
/// <summary> /// Attacks the defender /// </summary> /// <param name="defender">Entity to be attacked</param> /// <returns>Damage done</returns> protected int attack(IDefendable defender) { this.isActive = true; // controls state, should be fsm //this.entity = attack_color; // should be animation return defender.Defend(this.entity_attack); // the defender modifies its own HP using this entity's damage }
/// <summary> /// Looks for a target and att acks if it finds one /// </summary> /// <returns>Damage done or -1 if no target</returns> private int try_attack() { this.isActive = false; // controls state... if (this.target == null) this.target = this.FindTarget(this.entity); // find target is a big chunk of the ai if (this.target != null) // null if no valid target return this.attack(target); // change state to 'isAttacking', etc else return -1; // no target }
public override void Dispose() { //this.parent.ChildrenEntities.Remove(this); this.parent = null; this.defender = null; this.enabled = false; this.isAttacking = false; base.Dispose(); }
public int Attack(IDefendable defender) { this.isAttacking = true; return defender.Defend(this); }