public ChasingState(ZombieAI zAI) { zombieAI = zAI; zombieMove = zombieAI.GetComponent <ZombieMovement>(); animator = zombieAI.GetComponent <Animator>(); timer = GameObject.FindGameObjectWithTag("GameController").GetComponent <Timer>(); isScreamed = false; attacked = false; }
//after the gas leaves, Dinos resume can be unstun and will begin functioning normal again //after the gas leaves, the Player's gas timers are reset, and gas masks removed if any void OnTriggerExit(Collider other) { if (other.GetComponent <ZombieAI>()) { ZombieAI zombie = other.GetComponent <ZombieAI>(); zombie.GetComponent <Stunable>().bStayStunned = false; zombie.GetComponent <Stunable>().IsStunned = false; } }
private float currentWaitTime; //巡逻点的等待时间,默认为5 public PatrolState(ZombieAI zAI) { zombieAI = zAI; zombieMove = zombieAI.GetComponent <ZombieMovement>(); waypointIndex = 0; currentWaitTime = 5f; }
//while colliding with the gas, Dinos and the Player will be affected by it void OnTriggerStay(Collider other) { if (mGasActive) { //if a Dino is colliding with the gas, it is stunned and will stay stunned as long as it touches the gas if (other.GetComponent <ZombieAI>()) { other.GetComponent <ZombieAI>().GetComponent <Stunable>().bStayStunned = true; other.GetComponent <ZombieAI>().GetComponent <Stunable>().IsStunned = true; } } else { if (other.GetComponent <ZombieAI>()) { ZombieAI zombie = other.GetComponent <ZombieAI>(); zombie.GetComponent <Stunable>().bStayStunned = false; zombie.GetComponent <Stunable>().IsStunned = false; } } }