public static void Postfix(ref bool __result, SwimInSchool __instance, IEcoTarget target) { if (__instance.gameObject == target.GetGameObject()) { __result = false; } }
void SetCurrentTarget(IEcoTarget newTarget) { currentTarget = newTarget; if (newTarget != null && newTarget.GetGameObject() != null) { swimBehaviour.SwimTo(currentTarget.GetPosition(), swimVelocity); } }
private bool IsValidTarget(IEcoTarget target) { if (Random.value > 0.75f) { return(false); } if (target == null || target.GetGameObject() == null) { return(false); } return(Vector3.Distance(transform.position, target.GetPosition()) < 35f); }
public static void Postfix(AggressiveWhenSeeTarget __instance, ref GameObject __result) { int maxSearchRings = __instance.maxSearchRings; // Not the exploding fish, those are actually more dangerous hiding in ambush if (CraftData.GetTechType(__instance.gameObject) == TechType.Crash) { DeathRun.crashFishSemaphore = true; } else if (Config.DEATHRUN.Equals(DeathRun.config.creatureAggression) || Config.EXORBITANT.Equals(DeathRun.config.creatureAggression)) { if (DayNightCycle.main.timePassedAsFloat >= DeathRun.FULL_AGGRESSION) { maxSearchRings *= 3; //BR// Triple aggression search after 40 minutes } else if (DayNightCycle.main.timePassedAsFloat >= DeathRun.MORE_AGGRESSION) { maxSearchRings *= 2; //BR// Double aggression search after 20 minutes } } else if (Config.HARD.Equals(DeathRun.config.creatureAggression)) { if (DayNightCycle.main.timePassedAsFloat > DeathRun.MORE_AGGRESSION) { maxSearchRings += 1; //BR// One extra aggression ring after 20 minutes } } if (Ocean.main.GetDepthOf(Player.main.gameObject) <= 5) { if (maxSearchRings > __instance.maxSearchRings + 1) { maxSearchRings = __instance.maxSearchRings + 1; } } IEcoTarget ecoTarget = EcoRegionManager.main.FindNearestTarget(__instance.targetType, __instance.transform.position, __instance.isTargetValidFilter, maxSearchRings); if (ecoTarget == null) { __result = null; } else { __result = ecoTarget.GetGameObject(); } DeathRun.crashFishSemaphore = false; }
private void UpdateShinyTarget() { GameObject gameObject = null; if (EcoRegionManager.main != null) { IEcoTarget ecoTarget = EcoRegionManager.main.FindNearestTarget(EcoTargetType.Shiny, base.transform.position, this.isTargetValidFilter, 1); if (ecoTarget != null) { gameObject = ecoTarget.GetGameObject(); //Debug.DrawLine(base.transform.position, ecoTarget.GetPosition(), Color.red, 2f); } else { gameObject = null; } } if (gameObject) { Vector3 direction = gameObject.transform.position - base.transform.position; float num = direction.magnitude - 0.5f; if (num > 0f && Physics.Raycast(base.transform.position, direction, num, Voxeland.GetTerrainLayerMask())) { gameObject = null; } } if (this.shinyTarget != gameObject && gameObject != null && gameObject.GetComponent <Rigidbody>() != null && gameObject.GetComponent <Pickupable>() != null) { if (this.shinyTarget != null) { if ((gameObject.transform.position - base.transform.position).magnitude > (this.shinyTarget.transform.position - base.transform.position).magnitude) { this.DropShinyTarget(); this.shinyTarget = gameObject; return; } } else { this.shinyTarget = gameObject; } } }
bool TrySearchForFood(out IEcoTarget result) { result = null; IEcoTarget specialEdible = EcoRegionManager.main.FindNearestTarget(QPatch.clownPincherSpecialEdible, transform.position, targetFilter, 1); if (specialEdible != null && specialEdible.GetGameObject() != null) { result = specialEdible; return(true); } IEcoTarget deadMeat = EcoRegionManager.main.FindNearestTarget(EcoTargetType.DeadMeat, transform.position, targetFilter, 1); if (deadMeat != null && deadMeat.GetGameObject() != null) { result = deadMeat; return(true); } return(false); }
public override float Evaluate(Creature creature) { if (frozen) { return(0f); } IEcoTarget closestTarget = EcoRegionManager.main.FindNearestTarget(targetType, transform.position, null, 1); if (closestTarget != null && closestTarget.GetGameObject() != null) { if (Vector3.Distance(closestTarget.GetPosition(), transform.position) < maxReactDistance) { performingAction = true; timeStopAction = Time.time + actionLength; if (lastScare) { lastScare.lastScarePosition = closestTarget.GetPosition(); } } } if (performingAction) { if (Time.time > timeStopAction) { performingAction = false; } } if (performingAction) { return(evaluatePriority); } else { return(0f); } }
private bool IsTargetValid(IEcoTarget target) { return(target.GetGameObject().GetComponentInParent <Player>() == null && (target.GetPosition() - this.creature.leashPosition).sqrMagnitude > 64f); }