//------------------------------------------------------------------------------------------------------ // 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); } runtController = this.GetComponent <NPCRuntController>(); runtHealth = this.GetComponent <Health>(); Attacking = false; }
Health health; //Health script attached to runt //---------------------------------------------------------------------------------------------- // Constructor public RuntIdleState(Transform[] wp, NPCRuntController npcRunt) { //assign the object's scripts npcRuntController = npcRunt; health = npcRunt.Health; //assign speed, waypoints and the stateID waypoints = wp; stateID = FSMStateID.Idle; curRotSpeed = 2.0f; curSpeed = 2.0f; }
List <Health> playerHealths = new List <Health>(); //Health script attached to the players //---------------------------------------------------------------------------------------------- // Constructor public RuntFleeState(Transform[] wp, NPCRuntController npcRunt) { //assign the object's scripts npcRuntController = npcRunt; health = npcRunt.Health; for (int i = 0; i < GameManager.instance.Players.Count; i++) { playerHealths.Add(GameManager.instance.Players[i].GetComponent <Health>()); } //assign speed, waypoints, and the stateID waypoints = wp; stateID = FSMStateID.Fleeing; curRotSpeed = 2.0f; curSpeed = 6.0f; }
RuntAttack runtAttack; //RuntAttack script attached to the objects //---------------------------------------------------------------------------------------------- // Constructor public RuntMeleeAttackState(Transform[] wp, NPCRuntController npcRunt) { //assign the object's scripts npcRuntController = npcRunt; health = npcRunt.Health; for (int i = 0; i < GameManager.instance.Players.Count; i++) { playerHealths.Add(GameManager.instance.Players[i].GetComponent <Health>()); } runtAttack = npcRunt.GetComponent <RuntAttack>(); //assign speed, waypoints, the stateID, and the timers waypoints = wp; stateID = FSMStateID.MeleeAttacking; curRotSpeed = 1.0f; curSpeed = 0.0f; }
List <Health> playerHealths = new List <Health>(); //Health script attached to the players //EnemyTankShooting enemyTankShooting; //EnemyTankShooting script attached tothe objects //---------------------------------------------------------------------------------------------- // Constructor public RuntRangedAttackState(Transform[] wp, NPCRuntController npcRunt) { //assign the object's scripts npcRuntController = npcRunt; health = npcRuntController.Health; for (int i = 0; i < GameManager.instance.Players.Count; i++) { playerHealths.Add(GameManager.instance.Players[i].GetComponent <Health>()); } //enemyTankShooting = npcRuntController.GetComponent<EnemyTankShooting>(); //assign speed, waypoints, the stateID, and the timers waypoints = wp; stateID = FSMStateID.RangedAttacking; curRotSpeed = 2.0f; curSpeed = 0.0f; }
//---------------------------------------------------------------------------------------------- // Constructor public RuntChaseState(Transform[] wp, NPCRuntController npcRunt) { //assign the object's scripts npcRuntController = npcRunt; health = npcRunt.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.Chasing; elapsedTime = 0.0f; intervalTime = 1.0f; availSlotIndex = -1; curRotSpeed = 4.0f; curSpeed = 3.0f; }