public override bool KeepBehaviorCheck(AiShip leader, AiShip subject) { try { // Optimize -- Make sure the target is the same as the leaders. if (leader.GetTarget() == null) return false; if (leader.GetTarget().gameObject.name != subject.GetTarget().gameObject.name) return false; Attributes subjectStats = subject.getAttributes(); // Get Percent / 100% using cross multiply double health = GetCurrentHealthPercentage(); // comparison of factions may not work, check later. if (health >= 25 && leader.GetTarget() != null) return true; } catch { if (!subject) return false; if (subject.GetMyFleet().fleetLeader is PlayerShip) return false; if (!leader) leader = (AiShip)subject.GetMyFleet().fleetLeader; } return false; }
public override bool KeepBehaviorCheck(AiShip leader, AiShip subject) { Attributes subjectStats = subject.getAttributes(); // Get Percent / 100% using cross multiply double health = GetCurrentHealthPercentage(); // If ship is not damaged and has no target, search. (For Fleet leaders and Solo Ships only). if (health < 65 && subject.Aggressors.Count == 0) return true; return false; }
public override bool KeepBehaviorCheck(AiShip leader, AiShip subject) { // Make sure the ship hasn't become the faction leader. if (leader.ID == subject.ID) return false; Attributes subjectStats = subject.getAttributes(); // Get Percent / 100% using cross multiply double health = GetCurrentHealthPercentage(); float distance = Vector3.Magnitude(subject.gameObject.transform.position - leader.gameObject.transform.position); // If still strong enough to fight and is far away from leader, regroup. if (health >= 25 && distance > 1100) return true; return false; }
public override bool KeepBehaviorCheck(AiShip leader, AiShip subject) { hasAggressors = false; Attributes subjectStats = subject.getAttributes(); // Get Percent / 100% using cross multiply double health = GetCurrentHealthPercentage(); if (subject.Aggressors.Count > 0) hasAggressors = true; // If still too close or too damaged, keep running. if (health < 35 && hasAggressors) return true; return false; }
public override bool KeepBehaviorCheck(AiShip leader, AiShip subject) { // Optimize -- Make sure there is a target first. if (subject.GetTarget() == null) return false; Attributes subjectStats = subject.getAttributes(); // Get Percent / 100% using cross multiply double health = GetCurrentHealthPercentage(); AiShip targetShip = subject.GetTarget().gameObject.GetComponent("AiShip") as AiShip; string targetFaction = targetShip.getFaction(); // comparison of factions may not work, check later. if (health >= 25 && subject.getFaction() == targetFaction) return true; return false; }
public override bool KeepBehaviorCheck(AiShip leader, AiShip subject) { // Optimize -- Make sure there is a target first. if (subject.GetTarget() == null) return false; Attributes subjectStats = subject.getAttributes(); // Get Percent / 100% using cross multiply double health = GetCurrentHealthPercentage(); //Debug.Log("MAYBE TRUE"); // comparison of factions may not work, check later. if (health >= 15) return true; Debug.Log("SOLO FALSE"); return false; }
public override bool KeepBehaviorCheck(AiShip leader, AiShip subject) { Attributes subjectStats = subject.getAttributes(); // Get Percent / 100% using cross multiply double health = (subjectStats.structureHealth * 100) / subjectStats.maxStructureHealth; float distance = 999999999999; // Figure out how far we are from the Aggressors foreach (GameObject go in subject.Aggressors.Keys) { float distanceBetween = Vector3.Magnitude(subject.gameObject.transform.position - go.transform.position); if (distance > distanceBetween) distance = distanceBetween; } // If still too close or too damaged, keep running. if (health < 15 && distance < 15000) return true; return false; }
public override bool KeepBehaviorCheck(AiShip leader, AiShip subject) { if (ship.Aggressors.Count > 0 ) { //Debug.Log("Search has aggressors :: " + ship.name); return false; } if (ship.target != beacon.transform && ship.target != null) { // if (ship.target != beacon.transform) // //Debug.Log("Search has target other than beacon"); // else // //Debug.Log("Search has target is null"); return false; } Attributes subjectStats = subject.getAttributes(); // Get Percent / 100% using cross multiply double health = GetCurrentHealthPercentage(); // If ship is not damaged and has no target, search. (For Fleet leaders and Solo Ships only). if (health >= 75 && subject.GetTarget() == beacon.transform) return true; //Debug.Log("Behavior Not Kept"); return false; }