// Start is called before the first frame update
 void Start()
 {
     PatrolReturn      = 0;
     agent             = transform.parent.GetComponent <NavMeshAgent>();
     agent.destination = agent.transform.position;
     CurrentBehavior   = new NPCPatrolState(PatrolPoints, PatrolReturn);
 }
Example #2
0
    void Start()
    {
        idleState    = new NPCStateIdle(this);
        talkingState = new NPCStateTalking(this);
        currentState = idleState;

        player      = GameObject.FindGameObjectWithTag("Player");
        startingPos = transform.rotation;
    }
 //Stop Chasing
 private void OnTriggerExit(Collider other)
 {
     if (other.gameObject.name.Equals("Laika"))
     {
         excl.SetActive(false);
         sound.SetActive(false);
         CurrentBehavior = new NPCPatrolState(PatrolPoints, PatrolReturn);
     }
 }
Example #4
0
 // Update is called once per frame
 void Update()
 {
     if (Mathf.Abs(transform.position.x - player.transform.position.x) < 6 && Mathf.Abs(transform.position.z - player.transform.position.z) < 6)
     {
         currentState = talkingState;
         LookAtPlayer();
     }
     else
     {
         currentState = idleState;
         Idle();
     }
 }
 //Begin Chasing
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name.Equals("Laika"))
     {
         excl.SetActive(true);
         sound.SetActive(true);
         if (CurrentBehavior is NPCPatrolState)
         {
             PatrolReturn = ((NPCPatrolState)CurrentBehavior).GetPatrolReturn();
         }
         CurrentBehavior = new NPCChasingState(other.gameObject);
     }
 }
Example #6
0
 //In case of Death state, Exit will be handled differently
 public INPCState ExitState(INPCState newState, BossController npc)
 {
     return(newState.EnterState(npc));
 }
 // Update is called once per frame
 void Update()
 {
     currentState     = currentState.DoState(this);
     currentStateName = currentState.ToString();
 }
 private void OnEnable()
 {
     currentState = wanderState;
 }
Example #9
0
 // Update is called once per frame
 void Update()
 {
     m_CurrentState = m_CurrentState.UpdateState(npc: this);
     //Debug.Log(m_CurrentState);
 }
Example #10
0
 private void OnEnable()
 {
     m_Target       = FindObjectOfType <PlayerBehavior>().transform; //This should be done the other way, with player registering itself
     m_CurrentState = m_MoveState.EnterState(npc: this);
     //m_hp = GetComponent<DamagableEntity>();
 }