// Static Cover TacticalAI.CoverData FindStaticCover(Transform targetTransform, Transform transformToDefend) { if (targetTransform && myTransform) { Vector3 targetTransformPos = targetTransform.position; //Closest Covers if (currentCoverSeekMethod == CoverSeekMethods.WithinCombatRange) { return(FindCoverWithinCombatRange(targetTransformPos, transformToDefend)); } //Advance Towards Cover else if (currentCoverSeekMethod == CoverSeekMethods.AdvanceTowardsTarget) { return(FindCoverWithinCombatRange(targetTransformPos, transformToDefend)); } //Random Cover else { return(FindRandomCover(targetTransformPos, transformToDefend)); } } TacticalAI.CoverData bsData = new TacticalAI.CoverData(); return(bsData); }
//public override void EachFrame() public override void AICycle() { if (coverFinderScript) { //Choose which part of the cpover node we should move to based on whether we are suppressed and firing. if (baseScript.useAdvancedCover || (!gunScript.IsFiring() || !baseScript.shouldFireFromCover)) { targetVector = baseScript.currentCoverNodePos; } else { targetVector = baseScript.currentCoverNodeFiringPos; } if (baseScript.currentCoverNodeScript || foundDynamicCover) { //If we can't reach our cover, find a different piece of cover. if (navI.PathPartial()) { LeaveCover(); } //Start the countdown to leave cover once we reach it. if (!baseScript.inCover && navI.ReachedDestination()) { baseScript.inCover = true; StartCoroutine(SetTimeToLeaveCover(Random.Range(minTimeInCover, maxTimeInCover))); } } else { //If we don't have cover, find cover. TacticalAI.CoverData coverData = coverFinderScript.FindCover(baseScript.targetTransform, baseScript.keyTransform); if (coverData.foundCover) { SetCover(coverData.hidingPosition, coverData.firingPosition, coverData.isDynamicCover, coverData.coverNodeScript); //Play vocalization if (soundScript) { soundScript.PlayCoverAudio(); } } //If we can't find cover, charge at our target. else if (baseScript.targetTransform && timeTilNoCoverCharge < 0) { NoCoverFindDest(); } } } //If we don't have cover, charge at our target. else if (baseScript.targetTransform && timeTilNoCoverCharge < 0) { NoCoverFindDest(); } }