public override void execute(AbstractEnemyAI enemyAI) { if (GameManager.player == null) { Executing = false; return; } entity.StopMoving(); entity.lookPos = GameManager.player.transform.position; if (entity.currentWeapon.attacking) { return; } if (entity.currentWeapon.CanSecondaryAttack()) { entity.SecondaryAttack(); } else { entity.Attack(); } if (!enemyAI.CanAttackTarget()) { entity.lookingAt = false; Executing = false; } }
public override void execute(AbstractEnemyAI enemyAI) { // If can see player update path to player and move towards. if (enemyAI.canSeePlayer && !enemyAI.CanAttackTarget()) { if (GameManager.player == null) { return; } enemyAI.targetPosition = GameManager.player.transform.position; enemyAI.AstarMoveToTarget(); } // If reached end of path and cannot see player stop executing ChaseState. else { enemyAI.targetPosition = transform.position; Executing = false; } }
public override bool conditionsMet(AbstractEnemyAI enemyAI) { return(enemyAI.canSeePlayer && !enemyAI.CanAttackTarget()); }