public void Zap(CyclopsSonarCreatureDetector.EntityData creatureToZap = null) { if (!AbleToZap()) { return; } ZapRadius(); UpdateCooldown(); if (creatureToZap != null) { var newTarget = new CreatureTarget(creatureToZap); if (newTarget.IsValidTarget) { target = newTarget; } } if (target != null && !target.IsValidTarget) { target = null; } if (target == null) { return; } ZapCreature(); }
internal static void Postfix(CyclopsSonarCreatureDetector.EntityData entityData, CyclopsSonarDisplay __instance) { if (entityData.entityType != CyclopsSonarDisplay.EntityType.Creature) { return; } if (entityData.attackCyclops == null) { return; } SubRoot cyclops = __instance.GetComponentInParent <SubRoot>(); if (cyclops == null) { QuickLogger.Error("Unable to find Cyclops SubRoot in CyclopsSonarDisplay parent"); return; } // Did we just detect an aggressive creature on sonar? if (!entityData.attackCyclops.IsAggressiveTowardsCyclops(cyclops.gameObject)) { return; } MCUServices.Find.AuxCyclopsManager <Zapper>(cyclops)?.Zap(entityData); }
internal static void Postfix(CyclopsSonarCreatureDetector.EntityData entityData, CyclopsSonarDisplay __instance) { if (entityData.entityType != CyclopsSonarDisplay.EntityType.Creature) { return; } if (entityData.attackCyclops == null) { return; } SubRoot cyclops = __instance?.noiseManager?.subRoot; if (cyclops == null) { QuickLogger.Error("Unable to find Cyclops SubRoot in CyclopsSonarDisplay parent"); return; } // Did we just detect an aggressive creature on sonar? if (!entityData.attackCyclops.IsAggressiveTowardsCyclops(cyclops.gameObject)) { return; } // Yes, both auto-defense zappers can be activated at the same time MCUServices.Find.AuxCyclopsManager <AutoDefenser>(cyclops)?.Zap(entityData); MCUServices.Find.AuxCyclopsManager <AutoDefenserMk2>(cyclops)?.Zap(entityData); }
public CreatureTarget(CyclopsSonarCreatureDetector.EntityData entityData) { if (entityData?.gameObject != null) { liveMixin = entityData.gameObject.GetComponent <LiveMixin>(); } else { liveMixin = null; } }
public void Zap(CyclopsSonarCreatureDetector.EntityData creatureToZap = null) { if (!this.UpgradeHandler.HasUpgrade) { return; } if (!this.SeamothInBay) { return; } if (!this.HasElectricalDefense) { return; } if (this.IsOnCooldown) { return; } if (Cyclops.powerRelay.GetPower() < EnergyRequiredToZap) { return; } ZapRadius(); timeOfLastZap = Time.time; // Update time of last zap for cooldown purposes if (creatureToZap != null) { var newTarget = new CreatureTarget(creatureToZap); if (newTarget.IsValidTarget) { target = newTarget; } } if (!target.IsValidTarget) { target = null; } if (target == null) { return; } ZapCreature(); }