public override void Update(EnemyController_FSM enemy) { Patrol(enemy); if (Vector3.Distance(enemy.transform.position, enemy.PlayerPosition.position) <= enemy.patrolRadius) { states = EnemyStates.Chase; enemy.TransitionToState(enemy.chaseState); } }
public override void Update(EnemyController_FSM enemy) { enemy.AI.isStopped = true; enemy.AI.velocity = Vector3.zero; enemy.anim.SetBool(TagManager.Run, false); enemy.AI.speed = 0; currentTime += Time.deltaTime; if (currentTime >= enemy.waitBeforeAttack) { currentTime = 0; PlayRandomAttack(enemy); } if (Vector3.Distance(enemy.transform.position, enemy.PlayerPosition.position) > enemy.attackRadius) { enemy.TransitionToState(enemy.chaseState); } }
public override void Update(EnemyController_FSM enemy) { enemy.AI.SetDestination(enemy.PlayerPosition.position); enemy.AI.speed = enemy.chaseSpeed; enemy.AI.isStopped = false; if (enemy.AI.velocity.sqrMagnitude > 0) { enemy.anim.SetBool(TagManager.Run, true); } else { enemy.anim.SetBool(TagManager.Run, false); } if (Vector3.Distance(enemy.transform.position, enemy.PlayerPosition.position) <= enemy.attackRadius) { states = EnemyStates.Attack; enemy.TransitionToState(enemy.attackState); } }