/// <summary> /// Updates the enemy using the AI /// </summary> /// <param name="ElapsedTime">Time in seconds since last update</param> /// <param name="enemy">Enemy to update</param> public override void Update(float ElapsedTime, Enemy enemy) { enemy.position = enemy.initialPosition; }
public RelaxState(Enemy enemy, float relaxTime) { this.enemy = enemy; this.relaxTime = relaxTime; enemy.velocity = new Vector2(0, 0); }
public ReturnState(Enemy enemy) { this.enemy = enemy; enemy.velocity = new Vector2(0, 0); }
public ChaseState(Enemy enemy, Player player) { this.enemy = enemy; enemy.chasing = player; enemy.velocity = new Vector2(0, 0); }
/// <summary> /// Updates the enemy using the AI /// </summary> /// <param name="ElapsedTime">Time in seconds since last update</param> /// <param name="enemy">Enemy to update</param> public override void Update(float ElapsedTime, Enemy enemy) { enemy.velocity = new Vector2(speed * Math.Sign(enemy.chasing.position.X - enemy.position.X), 0); }
/// <summary> /// Updates the enemy using the AI /// </summary> /// <param name="ElapsedTime">Time in seconds since last update</param> /// <param name="enemy">Enemy to update</param> public override void Update(float ElapsedTime, Enemy enemy) { enemy.velocity = new Vector2(0, 0); }
/// <summary> /// Updates the enemy using the AI /// </summary> /// <param name="ElapsedTime">Time in seconds since last update</param> /// <param name="enemy">Enemy to update</param> public abstract void Update(float ElapsedTime, Enemy enemy);
/// <summary> /// Updates the enemy using the AI /// </summary> /// <param name="ElapsedTime">Time in seconds since last update</param> /// <param name="enemy">Enemy to update</param> public override void Update(float ElapsedTime, Enemy enemy) { Vector2 direction = VectorHelper.Normalize(enemy.chasing.position - enemy.position); enemy.velocity = direction * speed; }