private void OnEnable() { _mystate = CharCoordinatorStates.NotInitialized; _myIchar = GetComponent <ICharacterAnim>(); character = GetComponent <Dweller3rdPerson>(); agent = GetComponent <NavMeshAgent>(); }
public void ActivateAgent() { agent.enabled = true; if (agent.isActiveAndEnabled) { // print("ACTIVIA"); } else { // print("POOP"); } AgentIsAwake = true; _mystate = CharCoordinatorStates.Initialized; }
void USeAI() { if (agent.remainingDistance > agent.stoppingDistance) { character.Move(agent.desiredVelocity, false, false); } else //reached destination { if (!NOtStartedWalking) { print("started Nav To TArget"); _mystate = CharCoordinatorStates.MovingToTarget; NOtStartedWalking = true; } character.Move(Vector3.zero, false, false); } CheckIfReached(); }
void CheckIfReached() { if (!agent.pathPending) { if (agent.remainingDistance <= agent.stoppingDistance) { if (!agent.hasPath || agent.velocity.sqrMagnitude == 0f) { if (!arrived) { print("NOW WE HERE"); DoUseAi = false; arrived = true; character.Reset_ReachedRot(); _mystate = CharCoordinatorStates.RotatingToPlace; } } } } }
void RotationCompleted() { print("fin trn"); _mystate = CharCoordinatorStates.Interacting; }