void CheckOOIs(StateController controller, DestructableEnitity mydEntity) //check list in FOV script for what needs to be reacted to { Transform newooi = null; //use this to assign the highest prioity transform, then pass it to a checking fuction. for (int i = 0; i < controller.fov.visableTagets.Count; i++) { Transform ooi = controller.fov.visableTagets[i].transform; DestructableEnitity otherdEntity = ooi.GetComponent <DestructableEnitity>(); if (otherdEntity != null) { int otherReactionValue = otherdEntity.objectReactionValue; if (otherReactionValue > mydEntity.priorityOfCurrentReaction) { mydEntity.priorityOfCurrentReaction = otherReactionValue; newooi = ooi; } } } if (newooi != null) { AssignNewOOI(controller, newooi); } }
public override void Act(StateController controller) { if (!controller.bPrimaryStateActionFinished) { DestructableEnitity dEnitity = controller.transform.GetComponent <DestructableEnitity>(); if (dEnitity != null) { dEnitity.StopReacting(); } controller.bPrimaryStateActionFinished = true; } }
IEnumerator CheckForHighierPriorityIssues(StateController controller) { float refreshTime = 0.1f; DestructableEnitity mydEntity = controller.transform.GetComponent <DestructableEnitity>(); while (true) { if (controller.fov.bIsTargetInLOS) { CheckOOIs(controller, mydEntity); } yield return(new WaitForSeconds(refreshTime)); } }