public static void SelectNearestEnemyV1(BaseMonoAvatar aAvatar) { List <BaseMonoMonster> monsters = new List <BaseMonoMonster>(); foreach (BaseMonoMonster monster in Singleton <MonsterManager> .Instance.GetAllMonsters()) { if (monster.IsActive() && !monster.denySelect) { monsters.Add(monster); } } if (monsters.Count != 0) { BaseMonoEntity attackTarget = null; if (monsters.Count > 0) { FilterNearestMonsterTarget(aAvatar, monsters, ref attackTarget); } else { attackTarget = null; } aAvatar.SetAttackTarget(attackTarget); } }
private Vector3 GetSpawnPointPos(float distance, bool fromTarget = false) { Vector3 position = base.entity.transform.position; if (fromTarget) { BaseMonoEntity attackTarget = base.entity.GetAttackTarget(); if (attackTarget != null) { position = attackTarget.transform.position; } } MonoStageEnv stageEnv = Singleton <StageManager> .Instance.GetStageEnv(); int index = -1; float num2 = 100f; for (int i = 0; i < Singleton <StageManager> .Instance.GetStageEnv().spawnPoints.Length; i++) { float num4 = Mathf.Abs((float)(Vector3.Distance(stageEnv.spawnPoints[i].transform.position, position) - distance)); if (num4 < num2) { index = i; num2 = num4; } } return(stageEnv.spawnPoints[index].transform.position); }
public void FireMixinEffect(MixinEffect effectConfig, BaseMonoEntity target, Vector3 pos, Vector3 forward, bool allowInactiveFire = false) { if ((effectConfig != null) && (target != null)) { bool flag = false; if (allowInactiveFire) { flag = true; } else if (this.entity.gameObject.activeSelf) { flag = true; } if (flag) { if (effectConfig.EffectPattern != null) { this.entity.FireEffect(effectConfig.EffectPattern, pos, forward); } if (effectConfig.AudioPattern != null) { this.entity.PlayAudio(effectConfig.AudioPattern, target.transform); } } } }
public override void OnAwake() { BaseMonoEntity component = base.GetComponent <BaseMonoEntity>(); this._animatorEntity = (BaseMonoAnimatorEntity)component; this._target = base.GetComponent <BaseMonoAbilityEntity>().GetAttackTarget(); }
public static List <CollisionResult> CylinderCollisionDetectBySphere(Vector3 hitCastFromCenter, Vector3 cylinderCenterPoint, float radius, float height, LayerMask mask) { List <CollisionResult> results = new List <CollisionResult>(); if (radius > 0f) { int num = Physics.SphereCastNonAlloc(cylinderCenterPoint - ((Vector3)(radius * Vector3.up)), radius, Vector3.up, _raycastHitsBuffer, radius + height, (int)mask); for (int i = 0; i < num; i++) { RaycastHit hit = _raycastHitsBuffer[i]; Collider collider = hit.collider; BaseMonoEntity componentInParent = collider.gameObject.GetComponentInParent <BaseMonoEntity>(); if ((componentInParent != null) && !IsEntityAlreadyInResults(results, componentInParent)) { RaycastHit hit2; Vector3 origin = hitCastFromCenter; origin.y = height * 0.5f; if (!CenterHit(origin, collider, out hit2)) { hit2 = hit; Vector3 vector2 = hitCastFromCenter - hit2.point; vector2.y = 0f; hit2.normal = vector2; } results.Add(new CollisionResult(componentInParent, hit2.point, -hit2.normal)); } } } return(results); }
protected override void InitBulletForwardWithArgument(AbilityTriggerBullet bullet, HitExplodeTracingBulletMixinArgument arg, uint otherID) { base.InitBulletForwardWithArgument(bullet, arg, otherID); if (this.config.IsRandomInit) { if (this.config.IsRandomInitCone) { bullet.triggerBullet.transform.forward = (Vector3)((Quaternion.AngleAxis((float)UnityEngine.Random.Range(-40, 40), base.entity.transform.up) * Quaternion.AngleAxis((float)-UnityEngine.Random.Range(-10, 40), base.entity.transform.right)) * base.entity.transform.forward); } else { bullet.triggerBullet.transform.forward = (Vector3)(Quaternion.AngleAxis((float)-UnityEngine.Random.Range(20, 0x2d), base.entity.transform.right) * base.entity.transform.forward); } } BaseMonoEntity entity = null; if (otherID != 0) { entity = Singleton <EventManager> .Instance.GetEntity(otherID); } int num = this._traceBullets.SeekAddPosition <TraceDelay>(); TraceDelay delay = new TraceDelay { lineTimer = this.config.TurnStartDelay, turnTimer = this.config.TraceStartDelay, bulletID = bullet.runtimeID, subAttackTarget = entity }; this._traceBullets[num] = delay; }
public override void Init(BaseMonoEntity entity) { this.prop = (BaseMonoPropObject)entity; this.config = this.prop.config; base.commonConfig = this.config.CommonConfig; base.Init(entity); for (int i = 0; i < this.config.Abilities.Length; i++) { ConfigEntityAbilityEntry entry = this.config.Abilities[i]; base.appliedAbilities.Add(Tuple.Create <ConfigAbility, Dictionary <string, object> >(AbilityData.GetAbilityConfig(entry.AbilityName, entry.AbilityOverride), new Dictionary <string, object>())); } if (this.config.PropArguments.IsTriggerField) { this._triggerFieldPlugin = new ActorTriggerFieldPlugin(this); base.AddPlugin(this._triggerFieldPlugin); } for (int j = 0; j < 0x1b; j++) { AbilityState state = (AbilityState)(((int)1) << j); if (((state & (AbilityState.Undamagable | AbilityState.MaxMoveSpeed | AbilityState.Immune | AbilityState.CritUp | AbilityState.Shielded | AbilityState.PowerUp | AbilityState.AttackSpeedUp | AbilityState.MoveSpeedUp | AbilityState.Endure)) != AbilityState.None) || ((state & (AbilityState.Tied | AbilityState.TargetLocked | AbilityState.Fragile | AbilityState.Weak | AbilityState.AttackSpeedDown | AbilityState.MoveSpeedDown | AbilityState.Frozen | AbilityState.Poisoned | AbilityState.Burn | AbilityState.Paralyze | AbilityState.Stun | AbilityState.Bleed)) != AbilityState.None)) { base.SetAbilityStateImmune(state, true); } } Singleton <EventManager> .Instance.RegisterEventListener <EvtLevelBuffState>(base.runtimeID); this._opacity = 1f; }
public GameObject CreateGroupedEffectPattern(string patternName, BaseMonoEntity entity = null) { List <MonoEffect> list; if (entity == null) { entity = Singleton <LevelManager> .Instance.levelEntity; } GameObject obj2 = new GameObject(patternName) { transform = { position = InLevelData.CREATE_INIT_POS } }; Vector3 position = obj2.transform.position; Vector3 forward = obj2.transform.forward; this.TriggerEntityEffectPatternRaw(patternName, position, forward, Vector3.one, entity, out list); for (int i = 0; i < list.Count; i++) { MonoEffect effect = list[i]; effect.SetOwner(entity); effect.SetupPlugin(); effect.transform.parent = obj2.transform; this._managedEffectSet.Add(effect.GetRuntimeID()); } return(obj2); }
protected Vector3 GetTeleportPosition(TeleportDirectionMode mode, float angle, float distance) { Vector3 direction; switch (mode) { case TeleportDirectionMode.UseAngle: case TeleportDirectionMode.CameraCenter: case TeleportDirectionMode.UseSteerAngle: direction = this.GetDirection(this.config.DirectionMode, base.instancedAbility.Evaluate(this.config.Angle)); return(base.entity.transform.position + ((Vector3)(direction * distance))); case TeleportDirectionMode.FromTarget: { BaseMonoEntity attackTarget = base.entity.GetAttackTarget(); if (attackTarget != null) { Vector3 vector2 = base.entity.transform.position - attackTarget.transform.position; direction = vector2.normalized; return(attackTarget.transform.position + ((Vector3)(direction * distance))); } return(base.entity.transform.position); } case TeleportDirectionMode.SpawnPoint: return(this.GetSpawnPointPos(this.config.SpawnPoint)); case TeleportDirectionMode.SpawnPointByDistance: return(this.GetSpawnPointPos(this.config.Distance, false)); case TeleportDirectionMode.SpawnPointByDistanceFromTarget: return(this.GetSpawnPointPos(this.config.Distance, true)); } return(base.entity.transform.position); }
public ShaderTransitionPlugin(BaseMonoEntity entity) : base(entity) { this._mats = new List <BaseMonoAnimatorEntity.SpecialStateMaterialData>(); this._dir = true; this._to = 1f; this._duration = 1f; }
private bool GetTargetCorner(BaseMonoEntity entity, Vector3 sourcePosition, Vector3 targetPosition, ref Vector3 targetCorner) { DetourElement element; this._detours.TryGetValue(entity.GetRuntimeID(), out element); if (element == null) { return(false); } if (Miscs.DistancForVec3IgnoreY(targetPosition, element.targetPosition) > this._getPathDisThreshold) { this._detours.Remove(entity.GetRuntimeID()); return(false); } if (Miscs.DistancForVec3IgnoreY(element.corners[element.targetCornerIndex], sourcePosition) <= element.disReachCornerThreshold) { if (element.targetCornerIndex == (element.corners.Length - 1)) { this._detours.Remove(entity.GetRuntimeID()); targetCorner = targetPosition; return(true); } element.targetCornerIndex++; targetCorner = element.corners[element.targetCornerIndex]; return(true); } targetCorner = element.corners[element.targetCornerIndex]; return(true); }
private void InitBulletPosAndForward(AbilityTriggerBullet bullet, out Vector3 startPos) { Vector3 forward; Vector3 zero = Vector3.zero; if (this.config.RandomPosPool.Length > 0) { this.randPosIx = ((this.randPosIx + 1) != this.config.RandomPosPool.Length) ? (this.randPosIx + 1) : 0; float[] numArray = this.config.RandomPosPool[this._posIndexOrderList[this.randPosIx]]; zero = new Vector3(numArray[0], numArray[1], numArray[2]); } startPos = bullet.triggerBullet.transform.TransformPoint(zero) - bullet.triggerBullet.transform.localPosition; Transform transform = bullet.triggerBullet.transform; transform.position += startPos; BaseMonoEntity entity = this._attackTarget; if ((entity == null) || !this.config.FaceTarget) { forward = base.entity.transform.forward; } else { forward = entity.GetAttachPoint("RootNode").position - bullet.triggerBullet.transform.position; } bullet.triggerBullet.transform.forward = forward; if (this.config.BackDistance > 0f) { Transform transform2 = bullet.triggerBullet.transform; transform2.position += (Vector3)(forward.normalized * this.config.BackDistance); } }
public void AddHintArrow(uint listenRuntimeID) { BaseMonoEntity listenEntity = Singleton <EventManager> .Instance.GetEntity(listenRuntimeID); string path = string.Empty; if (Singleton <RuntimeIDManager> .Instance.ParseCategory(listenRuntimeID) == 4) { path = "UI/HintArrowAlt/HintArrowMonsterAlt"; } else if (Singleton <RuntimeIDManager> .Instance.ParseCategory(listenRuntimeID) == 3) { path = "UI/HintArrowAlt/HintArrowAvatarAlt"; } else { if (!(listenEntity is BaseMonoDynamicObject) || (Singleton <EventManager> .Instance.GetActor(listenEntity.GetRuntimeID()) == null)) { throw new Exception("Invalid Type or State!"); } path = "UI/HintArrowAlt/HintArrowExitAlt"; } MonoHintArrow component = UnityEngine.Object.Instantiate <GameObject>(Miscs.LoadResource <GameObject>(path, BundleType.RESOURCE_FILE)).GetComponent <MonoHintArrow>(); component.Init(listenRuntimeID, listenEntity); component.transform.SetParent(this._hintRing.transform, false); this._hintArrowLs.Add(component); }
protected override void FireTriggerCallback(Collider other, BaseMonoEntity entity) { if (((other != null) && (entity != null)) && !this.IsColliderOff(other)) { base.FireTriggerCallback(other, entity); } }
private void SetHintArrowByScreenPos(MonoHintArrow arrow, BaseMonoEntity entity) { bool flag = (((entity != null) && entity.IsActive()) && !Singleton <AvatarManager> .Instance.IsLocalAvatar(entity.GetRuntimeID())) && !Singleton <CameraManager> .Instance.GetMainCamera().IsEntityVisible(entity); bool isArrowVisibleBefore = (arrow.state == MonoHintArrow.State.Visible) || (arrow.state == MonoHintArrow.State.FadingIn); bool flag3 = (entity == null) || entity.IsToBeRemove(); if ((arrow.state == MonoHintArrow.State.Hidden) && flag3) { UnityEngine.Object.Destroy(arrow.gameObject); } else if (isArrowVisibleBefore && !flag) { arrow.SetVisible(false); if (flag3) { arrow.SetDestroyUponFadeOut(); } } else if (!isArrowVisibleBefore && flag) { arrow.SetVisible(true); } if (flag) { this.UpdateHintArrow(arrow.transform, entity.XZPosition, isArrowVisibleBefore); } }
public bool IsEntityVisibleInCustomOffset(BaseMonoEntity entity, float fovOffset, float nearOffset, float farOffset) { bool flag = false; float fieldOfView = this.cameraComponent.fieldOfView; float nearClipPlane = this.cameraComponent.nearClipPlane; float farClipPlane = this.cameraComponent.farClipPlane; Camera cameraComponent = this.cameraComponent; cameraComponent.fieldOfView += fovOffset; Camera camera2 = this.cameraComponent; camera2.nearClipPlane += nearOffset; Camera camera3 = this.cameraComponent; camera3.farClipPlane += farOffset; Matrix4x4 projectionMatrix = this.cameraComponent.projectionMatrix; Collider component = entity.GetComponent <Collider>(); if ((component != null) && component.enabled) { flag = GeometryUtility.TestPlanesAABB(GeometryUtility.CalculateFrustumPlanes(projectionMatrix), component.bounds); } Vector3 vector = this.cameraComponent.WorldToViewportPoint(entity.XZPosition); flag = ((vector.z > 0f) && Miscs.IsFloatInRange(vector.x, 0f, 1f)) && Miscs.IsFloatInRange(vector.y, 0f, 1f); this.cameraComponent.fieldOfView = fieldOfView; this.cameraComponent.nearClipPlane = nearClipPlane; this.cameraComponent.farClipPlane = farClipPlane; return(flag); }
private void OnUpdateAttackTarget(BaseMonoEntity entity) { if ((entity != null) && this._isTutorialAvailable) { MonsterActor attackee = Singleton <EventManager> .Instance.GetActor <MonsterActor>(entity.GetRuntimeID()); BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar(); AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(localAvatar.GetRuntimeID()); EntityNature attackerNature = (EntityNature)attackee.metaConfig.nature; EntityNature attribute = (EntityNature)actor.avatarDataItem.Attribute; float num = DamageModelLogic.GetNatureDamageBonusRatio(attackerNature, attribute, attackee); if (((((attackee != null) && (actor != null)) && ((base.step == 0) && (base.GetCurrentStepState() == BaseLevelTutorial.StepState.Sleep))) && ((!this.IsAllStepDone() && (num > 1f)) && ((base.step == 0) && (base.GetCurrentStepState() == BaseLevelTutorial.StepState.Sleep)))) && !this.IsAllStepDone()) { this.ActiveCurrentStep(); this.WaitShowTutorialStep(this.GetDelayTime(base.step), new Action(this.ShowTutorialStep0)); } if ((((attackee != null) && (actor != null)) && ((this._killAmount >= 2) && (this._monsterCreatedAmount > 2))) && (((num > 1f) && (base.step == 2)) && ((base.GetCurrentStepState() == BaseLevelTutorial.StepState.Sleep) && !this.IsAllStepDone()))) { this.ActiveCurrentStep(); this.WaitShowTutorialStep(this.GetDelayTime(base.step), new Action(this.ShowTutorialStep2)); } } }
public override void OnAbilityTriggered(EvtAbilityStart evt) { if (evt.abilityArgument != null) { base.OnAbilityTriggered(evt); } else { int index = (base._loopIx >= base._loopCount) ? (base._loopCount - 1) : base._loopIx; BaseAbilityActor[] enemyActorsOf = Singleton <EventManager> .Instance.GetEnemyActorsOf <BaseAbilityActor>(base.actor); int num2 = this.config.ChargeMissleAmount[index]; int length = enemyActorsOf.Length; for (int i = 0; i < length; i++) { BaseMonoEntity target = enemyActorsOf[i].entity; this.TriggerAbility(target, this.config.AbilityName); } if (length > 0) { for (int j = 0; j < (num2 - length); j++) { BaseMonoEntity entity = enemyActorsOf[UnityEngine.Random.Range(0, length)].entity; this.TriggerAbility(entity, this.config.AbilityNameSub); } } else { for (int k = 0; k < (num2 - length); k++) { this.TriggerAbility(null, this.config.AbilityNameSub); } } } }
public void SetupOverride(BaseMonoEntity owner) { MonoEffectOverride component = owner.GetComponent <MonoEffectOverride>(); if (component != null) { MonoEffectPluginTrailSmooth smooth = base.GetComponent <MonoEffectPluginTrailSmooth>(); if (smooth != null) { smooth.HandleEffectOverride(component); } else { MonoEffectPluginTrailStatic @static = base.GetComponent <MonoEffectPluginTrailStatic>(); if (@static != null) { @static.HandleEffectOverride(component); } } MonoEffectPluginOverrideHandler handler = base.GetComponent <MonoEffectPluginOverrideHandler>(); if (handler != null) { handler.HandleEffectOverride(component); } } }
public BaseMonoEntity GetEntity(uint runtimeID) { if (runtimeID == 0x21800001) { return(Singleton <LevelManager> .Instance.levelEntity); } BaseMonoEntity entity = null; switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(runtimeID)) { case 2: return(Singleton <CameraManager> .Instance.GetCameraByRuntimeID(runtimeID)); case 3: return(Singleton <AvatarManager> .Instance.TryGetAvatarByRuntimeID(runtimeID)); case 4: return(Singleton <MonsterManager> .Instance.TryGetMonsterByRuntimeID(runtimeID)); case 5: return(entity); case 6: return(Singleton <DynamicObjectManager> .Instance.TryGetDynamicObjectByRuntimeID(runtimeID)); case 7: return(Singleton <PropObjectManager> .Instance.TryGetPropObjectByRuntimeID(runtimeID)); } return(entity); }
public static string GetDebugEntityName(BaseMonoEntity entity) { if (entity == null) { return("<!null>"); } return(string.Format("<{0}({1:x})>", Truncate(entity.gameObject.name, 10), entity.GetRuntimeID())); }
protected override void OnEntityEntered(Collider other, BaseMonoEntity entity) { if (this.IsColliderOff(other)) { int num = this._offColliders.SeekAddPosition <Tuple <BaseMonoEntity, Collider> >(); this._offColliders[num] = Tuple.Create <BaseMonoEntity, Collider>(entity, other); } }
public void TryToTransitToOtherBaseState(bool checkHasAnyControl, BaseMonoEntity attackTarget = null) { BaseFollowBaseState targetBaseState = this.GetTargetBaseState(checkHasAnyControl, attackTarget); if (targetBaseState != null) { this.TransitBaseState(targetBaseState, false); } }
public override void OnAbilityTriggered(EvtAbilityStart evt) { for (int i = 0; i < this.config.BulletNum; i++) { base.OnAbilityTriggered(evt); } this._attackTarget = base.entity.GetAttackTarget(); this._hitCount = this.config.MaxHitNum; }
private void AddSubAttackTarget(BaseMonoEntity target) { BaseMonoAvatar entity = base.actor.entity as BaseMonoAvatar; if (entity != null) { entity.AddTargetToSubAttackList(target); } }
private void StartFollow() { this._targetEntity = base.entity.GetAttackTarget(); Singleton <EventManager> .Instance.FireEvent(new EvtTeleport(base.actor.runtimeID), MPEventDispatchMode.Normal); this._isFollow = true; this._isApproching = false; this._isKeepingAway = false; }
private void KillBlackHole(bool doExplodeHit) { if ((this._fieldActor != null) && (this._fieldActor.triggerField != null)) { List <uint> insideRuntimeIDs = this._fieldActor.GetInsideRuntimeIDs(); this._fieldActor.triggerField.transform.position.y = 1f; for (int i = 0; i < insideRuntimeIDs.Count; i++) { uint runtimeID = insideRuntimeIDs[i]; BaseAbilityActor actor = Singleton <EventManager> .Instance.GetActor <BaseAbilityActor>(runtimeID); if (((actor != null) && (actor.gameObject != null)) && ((this.config.ModifierNames != null) && (this.config.ModifierNames.Length > 0))) { int index = 0; int length = this.config.ModifierNames.Length; while (index < length) { if (actor.abilityPlugin != null) { actor.abilityPlugin.TryRemoveModifier(base.instancedAbility, this.config.ModifierNames[index]); } index++; } } } if (doExplodeHit && (this.config.ExplodeAnimEventID != null)) { List <CollisionResult> list2 = CollisionDetectPattern.CylinderCollisionDetectBySphere(this._fieldActor.triggerField.XZPosition, this._fieldActor.triggerField.XZPosition, base.instancedAbility.Evaluate(this.config.Radius), 2f, Singleton <EventManager> .Instance.GetAbilityHitboxTargettingMask(base.actor.runtimeID, MixinTargetting.Enemy)); for (int j = 0; j < list2.Count; j++) { CollisionResult result = list2[j]; BaseMonoEntity collisionResultEntity = AttackPattern.GetCollisionResultEntity(result.entity); if (collisionResultEntity != null) { Singleton <EventManager> .Instance.FireEvent(new EvtHittingOther(base.actor.runtimeID, collisionResultEntity.GetRuntimeID(), this.config.ExplodeAnimEventID, result.hitPoint, result.hitForward), MPEventDispatchMode.Normal); } } } base.FireMixinEffect(this.config.DestroyEffect, this._fieldActor.triggerField, false); this._fieldActor.Kill(); this._blackHoleTimer.timespan = base.instancedAbility.Evaluate(this.config.Duration); this._blackHoleTimer.Reset(false); if ((this.config.CreationEffect != null) && (this.config.CreationEffect.EffectPattern != null)) { Singleton <EffectManager> .Instance.SetDestroyIndexedEffectPattern(this._blackHoleEffectIx); } foreach (KeyValuePair <BaseAbilityActor, int> pair in this._addedVelocityActorsAndIndexDic) { if ((pair.Key != null) && (pair.Key.entity != null)) { pair.Key.entity.SetAdditiveVelocityOfIndex(Vector3.zero, pair.Value); pair.Key.entity.SetHasAdditiveVelocity(false); } } this._addedVelocityActorsAndIndexDic.Clear(); } }
public bool GetTargetPosition(BaseMonoEntity entity, Vector3 sourcePosition, Vector3 targetPosition, ref Vector3 targetCorner) { if (!this.Raycast(entity.GetRuntimeID(), sourcePosition, targetPosition)) { targetCorner = targetPosition; return(true); } return(this.GetCornerAndCalcPathWhenNeed(entity, sourcePosition, targetPosition, ref targetCorner)); }
protected void SelectNearestEntity() { List <BaseMonoEntity> list = new List <BaseMonoEntity>(); foreach (BaseMonoAvatar avatar in Singleton <AvatarManager> .Instance.GetAllAvatars()) { if (avatar.IsActive()) { list.Add(avatar); } } foreach (BaseMonoMonster monster in Singleton <MonsterManager> .Instance.GetAllMonsters()) { if (monster.IsActive() && (monster != this._monster)) { list.Add(monster); } } if (list.Count != 0) { BaseMonoEntity newTarget = null; bool flag = false; if ((this._monster.AttackTarget != null) && this._monster.AttackTarget.IsActive()) { if ((this._monster.AttackTarget as BaseMonoAnimatorEntity).denySelect) { flag = false; } else { flag = true; } } float positiveInfinity = float.PositiveInfinity; if (flag) { positiveInfinity = Miscs.DistancForVec3IgnoreY(this._monster.AttackTarget.XZPosition, this._monster.XZPosition) * this.ChangeAvatarDistanceRatioBias; } float num2 = float.PositiveInfinity; foreach (BaseMonoEntity entity2 in list) { if (((entity2 != null) && entity2.IsActive()) && ((!(entity2 is BaseMonoAvatar) || !(entity2 as BaseMonoAvatar).denySelect) && (!(entity2 is BaseMonoMonster) || !(entity2 as BaseMonoMonster).denySelect))) { if (flag && (Miscs.DistancForVec3IgnoreY(entity2.XZPosition, this._monster.XZPosition) < positiveInfinity)) { newTarget = entity2; } else if (!flag && (Miscs.DistancForVec3IgnoreY(entity2.XZPosition, this._monster.XZPosition) < num2)) { newTarget = entity2; num2 = Miscs.DistancForVec3IgnoreY(entity2.XZPosition, this._monster.XZPosition); } } } this._monster.SetAttackTarget(newTarget); } }
private static float GetScoreByEllipse(BaseMonoAvatar aAvatar, BaseMonoEntity target, Vector3 mainDirection, float eccentricity) { Vector3 vector = target.XZPosition - aAvatar.XZPosition; float num = eccentricity; Vector3 vector2 = Vector3.Project(vector, mainDirection); float num2 = (vector2.x + vector2.z) / (mainDirection.x + mainDirection.z); return(((vector.magnitude / num) - num2) / ((1f / num) - num)); }