void SearchForFireballs() { if (fireballs.Length > 0) { foreach (Fireball f in fireballs) { float range = 1.0f; Survivor_AI sAI = FindClosestSurvivorToFireBall(f); float distance = Vector3.Distance(sAI.GetSurvivor().transform.position, f.transform.position); if (distance < range) { ResetSurvivorsBT(); sAI.GetBlackBoard().incomingFireball = f; sAI.GetBlackBoard().currentSurvivorPosition = sAI.GetSurvivor().transform.position; Task BT_Evade_Fireball = new Sequence_EvadeFireballs(); sAI.SetBehaviorTree(BT_Evade_Fireball); } } } }
void SurvivorFlee() { List <Enemy> enemies = GameManager.getAllEnemies(); if (enemies.Count > 0) { foreach (Enemy e in enemies) { float range = 5.0f; Survivor_AI sAI = FindClosestSurvivorToTarget(e); float distance = Vector3.Distance(sAI.GetSurvivor().transform.position, e.transform.position); if (distance < range) { ResetSurvivorsBT(); Task BT_Flee_Zombie = new Sequence_FleeZombie(); sAI.GetBlackBoard().target = e; sAI.GetBlackBoard().currentSurvivorPosition = sAI.GetSurvivor().transform.position; sAI.SetBehaviorTree(BT_Flee_Zombie); } } } }
void SpendGold() { if (GameManager.GetBreakTimeRemaining() > 0) { // let the first survivor on list make the purchasing decesions Survivor_AI sAI = survivorAIs[0]; ResetSurvivorsBT(); // reset before making purchases sAI.SetBehaviorTree(new Sequence_SpendGold()); } }
void DefensivePositionSetup(DefensivePosition pos) { for (int i = 0; i < pos.defensePoints.Length; i++) { Survivor_AI targetAI = null; for (int j = 0; j < survivorAIs.Length; j++) { Survivor_AI sAI = survivorAIs[j]; if (sAI.currDefensePoint == null) { targetAI = sAI; targetAI.currDefensePoint = pos.defensePoints[i]; targetAI.SetBehaviorTree(new Task_FindPath(targetAI.currDefensePoint.transform.position, targetAI)); break; } } } }
void SearchForHellephants() { List <Enemy> hellephants = GameManager.getHellephantList(); if (hellephants.Count > 0 && GameManager.getZomBearList().Count == 0) { ResetSurvivorsBT(); foreach (Enemy hellephant in hellephants) { Survivor_AI sAI = FindClosestSurvivorToTarget(hellephant); if (CheckWeapons()) { Task BT_Kill_Hellephant = new Sequence_KillHellephant(hellephant); sAI.SetBehaviorTree(BT_Kill_Hellephant); } } } }
void SearchForBears() { List <Enemy> bears = GameManager.getZomBearList(); if (bears.Count > 0) { ResetSurvivorsBT(); foreach (Enemy bear in bears) { Survivor_AI sAI = FindClosestSurvivorToTarget(bear); if (CheckWeapons()) { Task BT_Kill_Special = new Sequence_KillSpecial(bear); sAI.SetBehaviorTree(BT_Kill_Special); } } } Invoke("SearchForBears", 1.0f); }
public override TASK_RETURN_STATUS Run(Survivor_AI sAI) { sAI.SetBehaviorTree(new Sequence_DefaultFire()); return(TASK_RETURN_STATUS.SUCCESS); }