void Start() { NPCAnimator = GetComponent <Animator>(); SelenitState = NPCState.Work; selenit1 = new CurveMotion(this.gameObject, wayPoints); selenit1.MoveSetup(speed, forward: true, cycled: true); selenit1.RotateToPoint(workPoint); currentTime = Time.time; playerObjects = GameObject.Find("Player").GetComponent <PlayerObjects>(); playerEquipment = GameObject.Find("Player").GetComponent <PlayerEquipment>(); npcSFX = GetComponent <AudioSource>(); }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player") && !questCompleted) { if (SelenitState == NPCState.Panic) { return; } //Panic Test if (iSelenit) //for Selenit NPC { if (playerObjects.Scafandr && !playerEquipment.IsSelenit) { //Panic Action Transform[] panicPoints = new Transform[] { this.gameObject.transform, panicPoint }; panicWay = new CurveMotion(this.gameObject, panicPoints); panicWay.MoveSetup(speed * 2, forward: true, cycled: false); SelenitState = NPCState.Panic; NPCAnimator.SetBool("Walk", false); NPCAnimator.SetBool(workAnim, false); NPCAnimator.SetBool(panicAnim, true); return; } } else //for Astronaut NPC { if (playerEquipment.IsSelenit || (!playerEquipment.IsSelenit && playerObjects.Scafandr && !playerObjects.Helmet) || (!playerEquipment.IsSelenit && !playerObjects.Scafandr && playerObjects.Helmet)) { //Panic action Transform[] panicPoints = new Transform[] { this.gameObject.transform, panicPoint }; panicWay = new CurveMotion(this.gameObject, panicPoints); panicWay.MoveSetup(speed * 2, forward: true, cycled: false); SelenitState = NPCState.Panic; NPCAnimator.SetBool("Walk", false); NPCAnimator.SetBool(workAnim, false); NPCAnimator.SetBool(panicAnim, true); return; } } dialog = Instantiate(dialogPr); dialog.SetSentences(sentences); SelenitState = NPCState.Talk; NPCAnimator.SetBool("Walk", false); NPCAnimator.SetBool(workAnim, false); } }