// stop meeting and initiate delay until next meeting can happen private void StopMeeting() { inMeeting = false; recentlyMetSomeone = true; currentPartner = null; Invoke("ReadyToMeetAgain", meetingTime * 2); CancelInvoke("StopMeeting"); }
private void OnEnable() { npc = this.GetComponent <NPC_Citizen1>(); idleState = this.GetComponent <IdleBasicState>(); avoidState = this.GetComponent <AvoidState>(); _taskController = this.GetComponent <NPC_Task_Controller>(); meetState = this.GetComponent <MeetNPCState>(); meetPlayerState = this.GetComponent <MeetPlayerState>(); }
protected override void OnEnable() { npc = this.GetComponent <NPC_BaseClass>(); idleState = this; avoidState = this.GetComponent <AvoidState>(); performTaskState = this.GetComponent <PerformTaskState>(); _taskController = this.GetComponent <NPC_Task_Controller>(); meetState = this.GetComponent <MeetNPCState>(); meetPlayerState = this.GetComponent <MeetPlayerState>(); }
//On trigger exit remove the other as partner. THis shouldn't happen but better safe than sorry private void OnTriggerExit(Collider other) { MeetNPCState other_meetable_npc = other.GetComponent <MeetNPCState>(); if (other_meetable_npc != null) { if (other_meetable_npc == currentPartner) { currentPartner = null; } } }
// If the other can meet, and this can meet set other as current partner public void TryMeetingNPC(Collider other) { MeetNPCState other_meetable_npc = other.GetComponent <MeetNPCState>(); if (other_meetable_npc != null) { if (other_meetable_npc.CanMeet() && this.CanMeet()) { currentPartner = other_meetable_npc; other_meetable_npc.currentPartner = this; } } }