public override TaskStatus OnUpdate() { if (this._entity is BaseMonoAvatar) { BaseMonoAvatar avatar = this._entity as BaseMonoAvatar; for (int i = 0; i < this.animatorTagNamesAvatar.Count; i++) { if (avatar.IsAnimatorInTag(this.animatorTagNamesAvatar[i])) { return(TaskStatus.Success); } } } else if (this._entity is BaseMonoMonster) { BaseMonoMonster monster = this._entity as BaseMonoMonster; for (int j = 0; j < this.animatorTagNamesMonster.Count; j++) { if (monster.IsAnimatorInTag(this.animatorTagNamesMonster[j])) { return(TaskStatus.Success); } } } return(TaskStatus.Failure); }
public override void OnAwake() { BaseMonoAnimatorEntity component = base.GetComponent <BaseMonoAnimatorEntity>(); if (component is BaseMonoAvatar) { this._aiEntity = (BaseMonoAvatar)component; this.moveSpeedKey.Value = "AvatarSpeed(FIXED)"; this._speed = 0f; } else if (component is BaseMonoMonster) { this._aiEntity = (BaseMonoMonster)component; this._speed = (component as BaseMonoMonster).GetOriginMoveSpeed(this.moveSpeedKey.Value); } this._aiController = this._aiEntity.GetActiveAIController(); this._monster = this._aiEntity as BaseMonoMonster; if (this.failMoveTime <= 0f) { this._usefailMoveTime = false; } else { this._usefailMoveTime = true; this._failMoveTimer = this.failMoveTime; } }
private int NearestTargetCompare(BaseMonoMonster monsterA, BaseMonoMonster monsterB) { float num = Vector3.Distance(base.entity.transform.position, monsterA.transform.position); float num2 = Vector3.Distance(base.entity.transform.position, monsterB.transform.position); return((int)(num - num2)); }
public override TaskStatus OnUpdate() { BaseMonoAnimatorEntity component = base.GetComponent <BaseMonoAnimatorEntity>(); if (component is BaseMonoMonster) { BaseMonoMonster monster = component as BaseMonoMonster; List <BaseMonoMonster> allMonsters = Singleton <MonsterManager> .Instance.GetAllMonsters(); for (int i = 0; i < allMonsters.Count; i++) { if (((allMonsters[i] != monster) && allMonsters[i].IsActive()) && (Vector3.Distance(allMonsters[i].XZPosition, monster.XZPosition) < this.range)) { return(TaskStatus.Success); } } return(TaskStatus.Failure); } if (component is BaseMonoAvatar) { BaseMonoAvatar avatar = component as BaseMonoAvatar; List <BaseMonoAvatar> allAvatars = Singleton <AvatarManager> .Instance.GetAllAvatars(); for (int j = 0; j < allAvatars.Count; j++) { if (((allAvatars[j] != avatar) && allAvatars[j].IsActive()) && (Vector3.Distance(allAvatars[j].XZPosition, avatar.XZPosition) < this.range)) { return(TaskStatus.Success); } } } return(TaskStatus.Failure); }
public AbilityShieldMixin(ActorAbility instancedAbility, ActorModifier instancedModifier, ConfigAbilityMixin config) : base(instancedAbility, instancedModifier, config) { this._shieldResumeRatio = 1f; this.config = (ShieldMixin)config; if (base.entity is BaseMonoMonster) { this._monsterEntity = (BaseMonoMonster)base.entity; this._monsterActor = (MonsterActor)base.actor; } this._showShieldBar = instancedAbility.Evaluate(this.config.ShowShieldBar) != 0; if (this.config.UseLevelTimeScale) { this._betweenAttackResumeTimer = new EntityTimer(this.config.BetweenAttackResumeCD); this._forceResumeTimer = new EntityTimer(this.config.ForceResumeCD); this._minForceResumeTimer = new EntityTimer(this.config.MinForceResumeCD); this._shieldResumeTimer = new EntityTimer(this.config.ShieldResumeTimeSpan); } else { this._betweenAttackResumeTimer = new EntityTimer(this.config.BetweenAttackResumeCD, base.entity); this._forceResumeTimer = new EntityTimer(this.config.ForceResumeCD, base.entity); this._minForceResumeTimer = new EntityTimer(this.config.MinForceResumeCD, base.entity); this._shieldResumeTimer = new EntityTimer(this.config.ShieldResumeTimeSpan, base.entity); } }
public virtual void BeingHit(AttackResult attackResult, BeHitEffect beHitEffect, uint sourceID) { bool doSteerToHitForward = false; bool targetLockSource = false; if ((attackResult.hitEffect > AttackResult.AnimatorHitEffect.Light) && (attackResult.hitCollision.hitDir != Vector3.zero)) { doSteerToHitForward = true; } if ((Singleton <AvatarManager> .Instance.IsLocalAvatar(base.runtimeID) && (this.avatar.AttackTarget == null)) && (this.avatar.IsAnimatorInTag(AvatarData.AvatarTagGroup.AllowTriggerInput) && (Singleton <RuntimeIDManager> .Instance.ParseCategory(sourceID) == 4))) { BaseMonoMonster monster = Singleton <MonsterManager> .Instance.TryGetMonsterByRuntimeID(sourceID); if ((monster != null) && !monster.denySelect) { targetLockSource = true; } } if ((this._paralyzeState == ParalyzeState.ParalyzeFreezed) && (attackResult.hitEffect > AttackResult.AnimatorHitEffect.Light)) { this.avatar.SetPropertyByStackIndex("Animator_OverallSpeedRatioMultiplied", this._paralyzeAnimatorSpeedIx, 1f); this._paralyzeTimer.timespan = 0.35f; this._paralyzeTimer.Reset(true); this._paralyzeState = ParalyzeState.ParalyzeHitResuming; } if (base.abilityState.ContainsState(AbilityState.Frozen)) { doSteerToHitForward = false; if (attackResult.hitEffect > AttackResult.AnimatorHitEffect.Light) { attackResult.hitEffect = AttackResult.AnimatorHitEffect.Light; } } this.avatar.BeHit(attackResult.frameHalt, attackResult.hitEffect, attackResult.hitEffectAux, attackResult.killEffect, beHitEffect, attackResult.aniDamageRatio, attackResult.hitCollision.hitDir, attackResult.retreatVelocity, sourceID, targetLockSource, doSteerToHitForward); }
private static void FilterMonsterTargetByEllipse(BaseMonoAvatar aAvatar, List <BaseMonoMonster> monsters, Vector3 mainDirection, float eccentricity, ref BaseMonoEntity monsterTarget, ref float monsterScore) { for (int i = 0; i < monsters.Count; i++) { BaseMonoMonster target = monsters[i]; if (!target.denySelect && target.IsActive()) { List <BaseMonoAbilityEntity> allHitboxEnabledBodyParts = target.GetAllHitboxEnabledBodyParts(); if (allHitboxEnabledBodyParts.Count > 0) { foreach (BaseMonoAbilityEntity entity in allHitboxEnabledBodyParts) { float num2 = GetScoreByEllipse(aAvatar, entity, mainDirection, eccentricity); if (num2 < monsterScore) { monsterTarget = entity; monsterScore = num2; } } } else { float num3 = GetScoreByEllipse(aAvatar, target, mainDirection, eccentricity); if (num3 < monsterScore) { monsterTarget = target; monsterScore = num3; } } } } }
public AbilityDefendModeMonsterMixin(ActorAbility instancedAbility, ActorModifier instancedModifier, ConfigAbilityMixin config) : base(instancedAbility, instancedModifier, config) { this._hatredAIAreaSections = new List <float>(); this._hatredAIValues = new List <int>(); this.config = (DefendModeMonsterMixin)config; this._monsterActor = base.actor as MonsterActor; this._monster = base.entity as BaseMonoMonster; this._monsterHatredDic = new Dictionary <uint, float>(); this._monsterHatredDic.Clear(); this._hatredDecreaseTimer = new EntityTimer(instancedAbility.Evaluate(this.config.HatredDecreaseInterval)); this._hatredDecreaseTimer.Reset(false); this._minAISwitchTimer = new EntityTimer(instancedAbility.Evaluate(this.config.MinAISwitchDuration)); this._minAISwitchTimer.Reset(false); for (int i = 0; i < this.config.hatredAIAreaSections.Length; i++) { this._hatredAIAreaSections.Add(this.config.hatredAIAreaSections[i]); } this._hatredAIAreaSections.Add(1f); for (int j = 0; j < this.config.hatredAIValues.Length; j++) { this._hatredAIValues.Add(this.config.hatredAIValues[j]); } this._defaultHatredAIValue = this.config.DefaultAIValue; this._currentHatredAIValue = this._defaultHatredAIValue; BTreeMonsterAIController activeAIController = (BTreeMonsterAIController)this._monster.GetActiveAIController(); if (activeAIController != null) { activeAIController.OnAIActive = (Action <bool>)Delegate.Combine(activeAIController.OnAIActive, new Action <bool>(this.OnMonsterAIActive)); } }
public void PreloadMonster(string monsterName, string typeName, uint uniqueMonsterID = 0, bool disableBehaviorWhenInit = false) { string name = monsterName + typeName + uniqueMonsterID.ToString() + disableBehaviorWhenInit.ToString(); for (int i = 0; i < this._preloadedMonsters.Count; i++) { if ((this._preloadedMonsters[i].name == name) && !this._preloadedMonsters[i].occupied) { this._preloadedMonsters[i].occupied = true; return; } } GameObject gameObj = (GameObject)UnityEngine.Object.Instantiate(Miscs.LoadResource <GameObject>(MonsterData.GetPrefabResPath(monsterName, typeName, !GlobalVars.MONSTER_USE_DYNAMIC_BONE || (Singleton <LevelManager> .Instance.levelActor.levelMode == LevelActor.Mode.Multi)), BundleType.RESOURCE_FILE), InLevelData.CREATE_INIT_POS, Quaternion.identity); BaseMonoMonster component = gameObj.GetComponent <BaseMonoMonster>(); component.PreInit(monsterName, typeName, uniqueMonsterID, disableBehaviorWhenInit); gameObj.SetActive(false); PreloadMonsterItem item = new PreloadMonsterItem(name, gameObj, component.config); this._preloadedMonsters.Add(item); ConfigMonster monster2 = MonsterData.GetMonsterConfig(monsterName, typeName, string.Empty); for (int j = 0; j < monster2.CommonArguments.PreloadEffectPatternGroups.Length; j++) { Singleton <EffectManager> .Instance.PreloadEffectGroup(monster2.CommonArguments.PreloadEffectPatternGroups[j], false); } for (int k = 0; k < monster2.CommonArguments.RequestSoundBankNames.Length; k++) { Singleton <WwiseAudioManager> .Instance.ManualPrepareBank(component.config.CommonArguments.RequestSoundBankNames[k]); } }
public uint CreateMonster(string monsterName, string typeName, int level, bool isLocal, Vector3 initPos, uint runtimeID, bool isElite = false, uint uniqueMonsterID = 0, bool checkOutsideWall = true, bool disableBehaviorWhenInit = false, int tagID = 0) { BaseMonoMonster component = null; GameObject gameObj = null; if (uniqueMonsterID != 0) { UniqueMonsterMetaData uniqueMonsterMetaData = MonsterData.GetUniqueMonsterMetaData(uniqueMonsterID); monsterName = uniqueMonsterMetaData.monsterName; typeName = uniqueMonsterMetaData.typeName; } string str = monsterName + typeName + uniqueMonsterID.ToString() + disableBehaviorWhenInit.ToString(); int index = 0; int num2 = 0; int count = this._preloadedMonsters.Count; while (num2 < count) { if (this._preloadedMonsters[num2].name == str) { gameObj = this._preloadedMonsters[num2].gameObj; index = num2; break; } num2++; } if (gameObj != null) { gameObj.SetActive(true); this._preloadedMonsters.RemoveAt(index); } else { gameObj = (GameObject)UnityEngine.Object.Instantiate(Miscs.LoadResource <GameObject>(MonsterData.GetPrefabResPath(monsterName, typeName, !GlobalVars.MONSTER_USE_DYNAMIC_BONE || (Singleton <LevelManager> .Instance.levelActor.levelMode == LevelActor.Mode.Multi)), BundleType.RESOURCE_FILE), InLevelData.CREATE_INIT_POS, Quaternion.identity); } component = gameObj.GetComponent <BaseMonoMonster>(); if (runtimeID == 0) { runtimeID = Singleton <RuntimeIDManager> .Instance.GetNextRuntimeID(4); } bool flag = checkOutsideWall; component.Init(monsterName, typeName, runtimeID, initPos, uniqueMonsterID, null, flag, isElite, disableBehaviorWhenInit, tagID); this.RegisterMonster(component); MonsterActor actor = Singleton <EventManager> .Instance.CreateActor <MonsterActor>(component); actor.InitLevelData(level, isElite); actor.PostInit(); int num4 = 0; int length = component.config.CommonArguments.RequestSoundBankNames.Length; while (num4 < length) { Singleton <WwiseAudioManager> .Instance.ManualPrepareBank(component.config.CommonArguments.RequestSoundBankNames[num4]); num4++; } return(component.GetRuntimeID()); }
public override TaskStatus OnUpdate() { BaseMonoMonster component = base.GetComponent <BaseMonoMonster>(); MonsterActor actor = Singleton <EventManager> .Instance.GetActor <MonsterActor>(component.GetRuntimeID()); this.HPRatio.SetValue((float)(actor.HP / actor.maxHP)); return(TaskStatus.Success); }
public void RemoveAttackingMonster(BaseMonoMonster monster) { if (this._attackingMonsters.Contains(monster)) { this._attackingMonsters.Remove(monster); } this.RefreshAvatarBeAttackMaxNum(); }
private void AttachDieCallback(BaseMonoMonster monster) { if (!this._waitDieMonsters.Contains(monster)) { monster.onDie = (Action <BaseMonoMonster>)Delegate.Combine(monster.onDie, new Action <BaseMonoMonster>(this.MonsterDieCallback)); this._waitDieMonsters.Add(monster); } }
public AbilityBronyaArsenalMixin(ActorAbility instancedAbility, ActorModifier instancedModifier, ConfigAbilityMixin config) : base(instancedAbility, instancedModifier, config) { this.config = (BronyaArsenalMixin)config; this._monster = base.entity as BaseMonoMonster; this._cannonList = new List <CannonInfo>(); this._chargeIndex = 0; this._Timer = 0f; this._state = ArsenalState.None; }
public BTreeMonsterAIController(BaseMonoMonster monster, string AIName, bool disableBehaviorWhenInit) : base(monster) { base._monster = monster; this._AIName = AIName; this._disableBehaviorWhenInit = disableBehaviorWhenInit; this.InitBTree(AIName); base.SetActive(true); this._state = State.WaitForStandby; monster.onAnimatorStateChanged = (Action <AnimatorStateInfo, AnimatorStateInfo>)Delegate.Combine(monster.onAnimatorStateChanged, new Action <AnimatorStateInfo, AnimatorStateInfo>(this.WaitFirstStandbyCallback)); }
public AbilityMonsterSkillIDChargeAnimatorMixin(ActorAbility instancedAbility, ActorModifier instancedModifier, ConfigAbilityMixin config) : base(instancedAbility, instancedModifier, config) { this.config = (MonsterSkillIDChargeAnimatorMixin)config; this._monster = (BaseMonoMonster)base.entity; this._chargeTimer = new EntityTimer(); this._triggeredChargeTimer = new EntityTimer(); this._switchTimer = new EntityTimer(this.config.ChargeSwitchWindow, base.entity); this._loopCount = this.config.ChargeLoopSkillIDs.Length; this._chargeTimeRatio = instancedAbility.Evaluate(this.config.ChargeTimeRatio); }
public AbilityMonsterTeleportMixin(ActorAbility instancedAbility, ActorModifier instancedModifier, ConfigAbilityMixin config) : base(instancedAbility, instancedModifier, config) { this.config = (MonsterTeleportMixin)config; this._baselineDistance = instancedAbility.Evaluate(this.config.BaselineDistance); this._monster = (BaseMonoMonster)base.entity; this._isTeleporting = false; this._teleportInterval = this.config.TeleportInverval; this._teleportTimer = new EntityTimer(this._teleportInterval); this._teleportTimer.Reset(false); }
private void OnHitStateChanged(BaseMonoMonster monster, bool fromHitState, bool toHitState) { if (!fromHitState && toHitState) { this.InterruptMainAISub(true); } else if (fromHitState && !toHitState) { this.InterruptMainAISub(false); } }
public bool IsOwnerStaticInScene() { if (this.owner is BaseMonoMonster) { BaseMonoMonster owner = this.owner as BaseMonoMonster; if ((owner != null) && owner.isStaticInScene) { return(true); } } return(false); }
public void InitFromMonsterActor(MonsterActor monsterActor, float hpRatioOfParent) { this.owner = monsterActor.monster; this.ownerActor = monsterActor; base.level = this.ownerActor.level; base.attack = this.ownerActor.attack; base.defense = this.ownerActor.defense; base.HP = base.maxHP = hpRatioOfParent * monsterActor.maxHP; base.monster.DisableShadow(); Physics.IgnoreCollision(this.owner.transform.GetComponent <Collider>(), base.monster.transform.GetComponent <Collider>()); base.monster.transform.position = this.owner.transform.position; }
private bool ListenKill(EvtKilled evt) { if (Singleton <RuntimeIDManager> .Instance.ParseCategory(evt.targetID) == 4) { BaseMonoMonster item = Singleton <MonsterManager> .Instance.TryGetMonsterByRuntimeID(evt.targetID); if ((item != null) && this._attackingMonsters.Contains(item)) { this.RemoveAttackingMonster(item); } } return(true); }
public override void Init() { this._monster = Singleton <MonsterManager> .Instance.GetMonsterByRuntimeID(base.runtimeID); this._monsterActor = Singleton <MPEventManager> .Instance.GetActor <MonsterActor>(base.runtimeID); base._animatorEntity = this._monster; base._abilityEntity = this._monster; base._abilityActor = this._monsterActor; this._monsterActor.GetPlugin <MPMonsterActorPlugin>().SetupIdentity(this); this._monsterActor.GetPluginAs <ActorAbilityPlugin, MPActorAbilityPlugin>().SetupIdentity(this); base.Init(); }
public void SetupView(AvatarActor attacker, MonsterActor attackee, float offset, Action <MonoSubMonsterHPBar> hideHPBarCallBack = null) { base.gameObject.SetActive(true); if (!this.attackerSet.Contains(attacker.runtimeID)) { this.attackerSet.Add(attacker.runtimeID); } this.attackee = attackee; this._offset = offset; this.enable = true; this._monster = attackee.entity as BaseMonoMonster; this._hideHPBarCallBack = hideHPBarCallBack; }
private void MonsterDieCallback(BaseMonoMonster monster) { if ((Singleton <MonsterManager> .Instance.LivingMonsterCount() == 0) || this.AlwaysTrigger) { if (!Singleton <CameraManager> .Instance.GetMainCamera().levelAnimState.active) { this.ShowLastKillCameraEffect(monster); } if (!this.AlwaysTrigger) { this._cameraActor.RemovePlugin(this); } } }
public override void OnAwake() { if (!string.IsNullOrEmpty(this.GruopAIGridType.Value)) { this.monster = base.GetComponent <BaseMonoMonster>(); this._minions = this.MinionDict.Value; if (this._minions == null) { this._minions = new Dictionary <int, BaseMonoEntity>(); this.MinionDict.Value = this._minions; } this._minionConfigLs = AIData.GetGroupAIGridEntry(this.GruopAIGridType.Value).Minions; } }
public static void ActAttackEffects(ConfigEntityAttackEffect attackEffectConfig, BaseMonoEntity entity, Vector3 hitPoint, Vector3 hitForward) { if ((attackEffectConfig != null) && !attackEffectConfig.MuteAttackEffect) { if (attackEffectConfig.EffectPattern != null) { if (attackEffectConfig.AttackEffectTriggerPos == AttackEffectTriggerAt.TriggerAtHitPoint) { TriggerAttackEffectsTo(attackEffectConfig.EffectPattern, hitPoint, hitForward, Vector3.one, entity); } else if (attackEffectConfig.AttackEffectTriggerPos == AttackEffectTriggerAt.TriggerAtHitPointRandom) { float max = 0.25f; float num2 = 0.1f; Vector3 vector = Vector3.Cross(Vector3.up, new Vector3(hitForward.x, 0f, hitForward.y)); Vector3.Normalize(vector); vector = (Vector3)(vector * UnityEngine.Random.Range(-num2, num2)); Vector3 vector2 = new Vector3(0f, UnityEngine.Random.Range(-max, max), 0f); TriggerAttackEffectsTo(attackEffectConfig.EffectPattern, (hitPoint + vector2) + vector, hitForward, Vector3.one, entity); } else if (attackEffectConfig.AttackEffectTriggerPos == AttackEffectTriggerAt.TriggerAtEntity) { TriggerAttackEffectsTo(attackEffectConfig.EffectPattern, entity.XZPosition, entity.transform.forward, entity.transform.localScale, entity); } } if (!string.IsNullOrEmpty(attackEffectConfig.SwitchName)) { string switchName = attackEffectConfig.SwitchName; BaseMonoMonster monster = entity as BaseMonoMonster; if ((monster != null) && monster.hasArmor) { if (switchName == "Bullet") { switchName = "Bullet_Armor"; } else if (switchName == "Punch") { switchName = "Shield_Default"; } else if (switchName == "Sword") { switchName = "Shield_Sword"; } } Singleton <WwiseAudioManager> .Instance.SetSwitch("Damage_Type", switchName, entity.gameObject); Singleton <WwiseAudioManager> .Instance.Post("DR_IMP", entity.gameObject, null, null); } } }
private bool OnPostMonsterCreated(EvtMonsterCreated evt) { if (evt.monsterID == this._stopWorldOwnerID) { return(false); } BaseMonoMonster target = Singleton <MonsterManager> .Instance.TryGetMonsterByRuntimeID(evt.monsterID); if (target != null) { this.ApplyStopEffectOn(target); } return(true); }
private bool FindEntity() { List <BaseMonoMonster> allMonsters = Singleton <MonsterManager> .Instance.GetAllMonsters(); for (int i = 0; i < allMonsters.Count; i++) { BaseMonoMonster monster = allMonsters[i]; if (Vector3.Distance(base.actor.entity.XZPosition, monster.XZPosition) <= base.instancedAbility.Evaluate(this.config.Radius)) { this._bufferEntity = monster; return(true); } } return(false); }
private void ShowLastKillCameraEffect(BaseMonoMonster monster) { BaseMonoAvatar avatar = Singleton <AvatarManager> .Instance.TryGetLocalAvatar(); Vector3 vector = monster.XZPosition - avatar.XZPosition; float magnitude = vector.magnitude; string filePath = (Singleton <MonsterManager> .Instance.LivingMonsterCount() != 0) ? "SlowMotionKill/Normal" : "SlowMotionKill/LastKill"; ConfigCameraSlowMotionKill config = ConfigUtil.LoadConfig <ConfigCameraSlowMotionKill>(filePath); MonoMainCamera mainCamera = Singleton <CameraManager> .Instance.GetMainCamera(); Vector3 vector2 = mainCamera.XZPosition - avatar.XZPosition; float distCamera = vector2.magnitude; mainCamera.SetSlowMotionKill(config, magnitude, distCamera); }
private void SampleBossTargetPosition() { Vector3 vector = new Vector3(0f, 0f, 0f); List<BaseMonoMonster> allMonsters = Singleton<MonsterManager>.Instance.GetAllMonsters(); for (int i = 0; i < allMonsters.Count; i++) { BaseMonoMonster monster = allMonsters[i]; vector += monster.XZPosition; } Vector3 vector2 = (Vector3) (vector / ((float) allMonsters.Count)); for (int j = this._followPositions.Length - 1; j > 0; j--) { this._followPositions[j] = this._followPositions[j - 1]; } this._followPositions[0] = vector2; }