private void OnTriggerEnter(Collider other) { Debug.Log("Player Dead"); // if the trap is disabled, nth gon happen yooo if (trapDisabled) { return; } if (other.gameObject.tag == "Player") { PlayerController playerController = other.GetComponent <PlayerController>(); AudioManager.instance.Play("hurt1"); AudioManager.instance.Play("trap"); playerController.isDead = true; playerController.isMoving = false; playerController.isPushing = false; //other.GetComponent<PlayerController>().RespawnPlayer(); } else if (other.tag == "Enemies") { AINavAgent aiController = other.GetComponent <AINavAgent>(); aiController.isDead = true; // do sme shit i think } }
public override void Act(GameObject player, GameObject npc) { AINavAgent npcNav = npc.GetComponent <AINavAgent>(); npcNav.Stop(); if ((Time.time - lastAttackTime) < 1.5) { return; } lastAttackTime = Time.time; npc.GetComponent <MonoBehaviour>().StartCoroutine("attackBehavior"); Debug.Log("Attack Complete"); }
public override void Act(GameObject player, GameObject npc) { if (!actionFinished) { ObjectHealth npcHealth = npc.GetComponent <ObjectHealth>(); AINavAgent npcNav = npc.GetComponent <AINavAgent>(); Rigidbody npcRB = npc.GetComponent <Rigidbody>(); if (npcHealth.isDead) { npcNav.enabled = false; npc.GetComponent <ZombieController>().StartCoroutine("death"); npcRB.isKinematic = true; actionFinished = true; } } }
public override void Act(GameObject player, GameObject npc) { playerTrans = player.transform; npcTrans = npc.transform; npcNav = npc.GetComponent <AINavAgent>(); npcNav.enabled = true; float playerDist = Vector3.Distance(npcTrans.position, playerTrans.position); if (npc.GetComponent <ZombieController>().soundDetector.Detect(player.GetComponent <PlayerController>(), playerDist)) { Debug.Log("Heard by " + npc.ToString()); destination = playerTrans.position; npcNav.SetDestination(destination); } npcNav.Resume(); npcNav.speed = 1f; }
public override void Act(GameObject player, GameObject npc) { playerTrans = player.transform; // Transform npcTrans = npc.transform; destination = playerTrans.position; npcNav = npc.GetComponent <AINavAgent>(); npcNav.enabled = true; npcNav.speed = 2f; if (doOnce == 0) { npcNav.SetDestination(destination); doOnce++; } npcNav.TrackMovingTarget(player.GetComponent <PlayerController>() as IAITrackable); }
public override void Act(GameObject player, GameObject npc) { npcTrans = npc.transform; npcNav = npc.GetComponent <AINavAgent>(); npcNav.Stop(); }