Health health; //Health script attached to object //---------------------------------------------------------------------------------------------- // Constructor public AdolescentIdleState(Transform[] wp, NPCAdolescentController npcAdolescent) { //assign the object's scripts npcAdolescentController = npcAdolescent; health = npcAdolescent.Health; //assign speed, waypoints and the stateID waypoints = wp; stateID = FSMStateID.Idle; curRotSpeed = 2.0f; curSpeed = 2.0f; }
//------------------------------------------------------------------------------------------------------ // Start is called before the first frame update void Start() { elapsedTime = 0.0f; players = new List <GameObject>(); foreach (GameObject player in GameManager.instance.Players) { players.Add(player); } adolescentController = this.GetComponent <NPCAdolescentController>(); adolescentHealth = this.GetComponent <Health>(); Attacking = false; }
AdolescentAttack adolescentAttack; //AdolescenetAttack script attached to the objects //---------------------------------------------------------------------------------------------- // Constructor public AdolescentMeleeAttackState(Transform[] wp, NPCAdolescentController npcAdolescent) { //assign the object's scripts npcAdolescentController = npcAdolescent; health = npcAdolescent.Health; for (int i = 0; i < GameManager.instance.Players.Count; i++) { playerHealths.Add(GameManager.instance.Players[i].GetComponent <Health>()); } adolescentAttack = npcAdolescentController.GetComponent <AdolescentAttack>(); //assign speed, waypoints, the stateID, and the timers waypoints = wp; stateID = FSMStateID.MeleeAttacking; curRotSpeed = 1.0f; curSpeed = 0.0f; }
//---------------------------------------------------------------------------------------------- // Constructor public AdolescentChargeState(Transform[] wp, NPCAdolescentController npcAdolescent) { //assign the object's scripts npcAdolescentController = npcAdolescent; health = npcAdolescent.Health; playerHealths = new List <Health>(); for (int i = 0; i < GameManager.instance.Players.Count; i++) { playerHealths.Add(GameManager.instance.Players[i].GetComponent <Health>()); } //assign speed, waypoints, the stateID, and the timers waypoints = wp; stateID = FSMStateID.Charging; elapsedTime = 0.0f; intervalTime = 1.0f; availSlotIndex = -1; curRotSpeed = 2.0f; curSpeed = 3.0f; }