public override void OnUpdate(Base_Ghost ghost) { PathRequestManager.RequestPath(ghost.transform.position, ghost.spawn.transform.position, ghost.OnPathFound); ghost.myMat.SetColor("_Color", Color.green); if (ghost.GotRescuedGhost == true) { ghost.ChangeState("Patrol"); } if (ghost.InFleeZone == true) { localtaggedTime -= Time.deltaTime; } if (localtaggedTime <= 0) { ghost.ChangeState("Patrol"); } }
public override void OnUpdate(Base_Ghost ghost) { LocalRageTime -= Time.deltaTime; ghost.myMat.SetColor("_Color", Color.red); float distance = Vector3.Distance(ghost.transform.position, ghost.player.transform.position); PathRequestManager.RequestPath(ghost.transform.position, ghost.player.transform.position, ghost.OnPathFound); if (distance < EnemyDistance) { ghost.speed = RageSpeed; } else { ghost.speed = LocalSpeed; } if (LocalRageTime <= 0) { ghost.ChangeState("Flee"); } }
public override void OnUpdate(Base_Ghost ghost) { LocalFleeTime -= Time.deltaTime; float distance = Vector3.Distance(ghost.transform.position, ghost.player.transform.position); ghost.myMat.SetColor("_Color", Color.yellow); if (LocalFleeTime <= 0) { ghost.ChangeState("Patrol"); } if (distance < EnemyDistance) { Vector3 dirToPlayer = ghost.transform.position - ghost.player.transform.position; Vector3 newPos = ghost.transform.position + dirToPlayer; PathRequestManager.RequestPath(ghost.transform.position, dirToPlayer, ghost.OnPathFound); } else { PathRequestManager.RequestPath(ghost.transform.position, ghost.transform.position, ghost.OnPathFound); } }