public AvatarStastics GetAvatarStastics(uint avatarRuntimeID) { BaseMonoAvatar helperAvatar = Singleton <AvatarManager> .Instance.GetHelperAvatar(); if ((helperAvatar != null) && (helperAvatar.GetRuntimeID() == avatarRuntimeID)) { return(null); } AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(avatarRuntimeID); if (actor == null) { return(null); } if (!this._avatarStasticsDict.ContainsKey(actor.avatarDataItem.avatarID)) { AvatarStastics stastics = new AvatarStastics(actor.avatarDataItem.avatarID) { avatarLevel = actor.level, avatarStar = actor.avatarDataItem.star, stageID = Singleton <LevelScoreManager> .Instance.LevelId }; this._avatarStasticsDict[actor.avatarDataItem.avatarID] = stastics; } return(this._avatarStasticsDict[actor.avatarDataItem.avatarID]); }
public override TaskStatus OnUpdate() { if ((this.retargetEntity.Value != null) && this.retargetEntity.Value.IsActive()) { this._monster.SetAttackTarget(this.retargetEntity.Value); this.retargetEntity.SetValue((BaseMonoEntity)null); return(TaskStatus.Success); } if (this._monster.AttackTarget == null) { BaseMonoAvatar newTarget = this.SelectNearestAvatar(); if (newTarget != null) { this._monsterAIPlugin.InitNearestAvatarThreat(newTarget.GetRuntimeID()); this._monster.SetAttackTarget(newTarget); return(TaskStatus.Success); } } else { uint runtimeID = this._monster.AttackTarget.GetRuntimeID(); uint num2 = this._monsterAIPlugin.RetargetByThreat(runtimeID); if (runtimeID != num2) { this._monster.SetAttackTarget(Singleton <AvatarManager> .Instance.GetAvatarByRuntimeID(num2)); } return(TaskStatus.Success); } return(TaskStatus.Running); }
public void InitForReviveButton(BaseMonoAvatar avatar) { this._button = base.GetComponent <Button>(); this._hpBarImg = base.transform.Find("HPBar/Inner").GetComponent <Image>(); this._spBarImg = base.transform.Find("SPBar/Inner").GetComponent <Image>(); this._iconImage = base.transform.Find("Icon").GetComponent <Image>(); this._CDMaskImg = base.transform.Find("CDMask").GetComponent <Image>(); this.avatarRuntimeID = avatar.GetRuntimeID(); this._avatar = avatar; this._avatarActor = (AvatarActor)Singleton <EventManager> .Instance.GetActor(this.avatarRuntimeID); GameObject obj2 = Miscs.LoadResource <GameObject>(this._avatarActor.avatarIconPath, BundleType.RESOURCE_FILE); this._iconImage.sprite = obj2.GetComponent <SpriteRenderer>().sprite; Transform transform = base.transform.Find("Attr"); for (int i = 0; i < transform.childCount; i++) { transform.GetChild(i).gameObject.SetActive(false); } transform.Find(this._avatarActor.avatarDataItem.Attribute.ToString()).gameObject.SetActive(true); this.onlyForShow = true; this._button.interactable = true; base.transform.Find("CDMask").gameObject.SetActive(true); }
private void ShareSPCallback(float from, float to, float amount) { if ((amount > 0f) && base.actor.abilityPlugin.EvaluateAbilityPredicate(this.config.Predicates, base.instancedAbility, base.instancedModifier, null, null)) { float num = base.instancedAbility.Evaluate(this.config.ShareSPRatio) * amount; List <BaseMonoAvatar> allPlayerAvatars = Singleton <AvatarManager> .Instance.GetAllPlayerAvatars(); for (int i = 0; i < allPlayerAvatars.Count; i++) { BaseMonoAvatar avatar = allPlayerAvatars[i]; if (((avatar != null) && avatar.IsAlive()) && (avatar.GetRuntimeID() != base.actor.runtimeID)) { Singleton <EventManager> .Instance.GetActor <AvatarActor>(avatar.GetRuntimeID()).HealSP(num); } } } }
private int Compare(BaseMonoAvatar a, BaseMonoAvatar b) { if ((a.GetRuntimeID() == this._localAvatarRuntimeID) && (b.GetRuntimeID() != this._localAvatarRuntimeID)) { return(-1); } if ((a.GetRuntimeID() != this._localAvatarRuntimeID) && (b.GetRuntimeID() == this._localAvatarRuntimeID)) { return(1); } if (a.IsActive() && !b.IsActive()) { return(-1); } if (!a.IsActive() && b.IsActive()) { return(1); } return(0); }
private void SetupAvatarId() { BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar(); foreach (BaseMonoAvatar avatar2 in Singleton <AvatarManager> .Instance.GetAllPlayerAvatars()) { AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(avatar2.GetRuntimeID()); if ((actor != null) && !Singleton <AvatarManager> .Instance.IsLocalAvatar(avatar2.GetRuntimeID())) { this.targetSwapAvatarId = actor.runtimeID; } } this.sourceSwapAvatarId = localAvatar.GetRuntimeID(); Singleton <NotifyManager> .Instance.FireNotify(new Notify(NotifyTypes.SwapBtnVisible, false)); }
private bool ListenStageReady(EvtStageReady evt) { BaseMonoAvatar avatar = Singleton <AvatarManager> .Instance.TryGetLocalAvatar(); if (this._mainCamera.followState.active) { Singleton <CameraManager> .Instance.GetMainCamera().SuddenSwitchFollowAvatar(avatar.GetRuntimeID(), false); } else { Singleton <WwiseAudioManager> .Instance.SetListenerFollowing(avatar.transform, new Vector3(0f, 2f, 0f)); this._mainCamera.SetupFollowAvatar(avatar.GetRuntimeID()); this._mainCamera.followState.SetEnterPolarMode(MainCameraFollowState.EnterPolarMode.AlongAvatarFacing, 0f); this._mainCamera.TransitToFollow(); } return(true); }
public void CollectAntiCheatData() { this.cheatDataList = new List <StageCheatData>(); this.AddData(0x3e9, (float)this._levelStartTime); this.AddData(0x3ea, (float)this._unscaledLevelTime); this.AddData(0x3eb, this._unscaledLevelTime / ((float)this._frameCount)); List <BaseMonoAvatar> allPlayerAvatars = Singleton <AvatarManager> .Instance.GetAllPlayerAvatars(); for (int i = 0; i < allPlayerAvatars.Count; i++) { BaseMonoAvatar avatar = allPlayerAvatars[i]; AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(avatar.GetRuntimeID()); AvatarStastics avatarStastics = this._damagePlugin.GetAvatarStastics(avatar.GetRuntimeID()); int num2 = i * 100; this.AddData((StageCheatData.Type)(0x7d1 + num2), (float)avatar.AvatarTypeID); this.AddData((StageCheatData.Type)(0x7d2 + num2), (float)actor.level); this.AddData((StageCheatData.Type)(0x7d3 + num2), actor.avatarDataItem.CombatNum); this.AddData((StageCheatData.Type)(0x7d4 + num2), (float)actor.attack); this.AddData((StageCheatData.Type)(0x7e6 + num2), (float)avatarStastics.onStageTime); this.AddData((StageCheatData.Type)(0x7da + num2), (float)avatarStastics.hpMax); this.AddData((StageCheatData.Type)(0x7db + num2), (float)avatarStastics.hpBegin); this.AddData((StageCheatData.Type)(0x7dc + num2), (float)actor.HP); this.AddData((StageCheatData.Type)(0x7dd + num2), (float)avatarStastics.hpGain); this.AddData((StageCheatData.Type)(0x7d5 + num2), (float)avatarStastics.spMax); this.AddData((StageCheatData.Type)(0x7d6 + num2), (float)avatarStastics.spBegin); this.AddData((StageCheatData.Type)(0x7d7 + num2), (float)actor.SP); this.AddData((StageCheatData.Type)(0x7d8 + num2), (float)avatarStastics.SpRecover); this.AddData((StageCheatData.Type)(0x7d9 + num2), (float)avatarStastics.spUse); this.AddData((StageCheatData.Type)(0x7de + num2), (float)avatarStastics.avatarHitTimes); this.AddData((StageCheatData.Type)(0x7df + num2), (float)avatarStastics.avatarDamage); this.AddData((StageCheatData.Type)(0x7e0 + num2), (float)avatarStastics.hitNormalDamageMax); this.AddData((StageCheatData.Type)(0x7e1 + num2), (float)avatarStastics.hitCriticalDamageMax); this.AddData((StageCheatData.Type)(0x7e2 + num2), (float)avatarStastics.avatarBeingHitTimes); this.AddData((StageCheatData.Type)(0x7e3 + num2), (float)avatarStastics.behitNormalDamageMax); this.AddData((StageCheatData.Type)(0x7e4 + num2), (float)avatarStastics.behitCriticalDamageMax); this.AddData((StageCheatData.Type)(0x7e5 + num2), (float)avatarStastics.comboMax); } }
private void InitTeam() { if (this.allTeamDown) { List <BaseMonoAvatar> allPlayerAvatars = Singleton <AvatarManager> .Instance.GetAllPlayerAvatars(); Transform transform = base.view.transform.Find("Dialog/Content/ReviveConsumePanel/AvatarSelectPanel"); for (int i = 0; i < transform.childCount; i++) { Transform child = transform.GetChild(i); if (i >= allPlayerAvatars.Count) { child.gameObject.SetActive(false); } else { BaseMonoAvatar avatar = allPlayerAvatars[i]; child.GetComponent <MonoAvatarButton>().InitForReviveButton(avatar); child.Find("CDMask").gameObject.SetActive(avatar.GetRuntimeID() != this.avatarRuntimeID); } } } }
public uint CreateAvatarMirror(BaseMonoAvatar owner, Vector3 initPos, Vector3 initDir, string AIName, float hpRatio) { BaseMonoAvatar component = ((GameObject)UnityEngine.Object.Instantiate(Miscs.LoadResource <GameObject>(AvatarData.GetPrefabResPath(owner.AvatarTypeName, true), BundleType.RESOURCE_FILE), initPos, Quaternion.LookRotation(initDir))).GetComponent <BaseMonoAvatar>(); component.Init(false, Singleton <RuntimeIDManager> .Instance.GetNextRuntimeID(3), owner.AvatarTypeName, owner.EquipedWeaponID, initPos, initDir, false); this.RegisterAvatar(component, false, false, false); AvatarMirrorActor actor = Singleton <EventManager> .Instance.CreateActor <AvatarMirrorActor>(component); actor.InitFromAvatarActor(Singleton <EventManager> .Instance.GetActor <AvatarActor>(owner.GetRuntimeID()), hpRatio); actor.PostInit(); component.TriggerSwitchIn(); BTreeAvatarAIController activeAIController = component.GetActiveAIController() as BTreeAvatarAIController; if (string.IsNullOrEmpty(AIName)) { activeAIController.SetActive(false); } else { activeAIController.ChangeBehavior(AIName); component.ForceUseAIController(); } return(component.GetRuntimeID()); }
public virtual void HandleLocalPlayerAvatarDie(BaseMonoAvatar diedAvatar) { BaseMonoAvatar firstAliveAvatar = Singleton <AvatarManager> .Instance.GetFirstAliveAvatar(); if (firstAliveAvatar != null) { diedAvatar.gameObject.SetActive(false); Singleton <LevelManager> .Instance.levelActor.SwapLocalAvatar(diedAvatar.GetRuntimeID(), firstAliveAvatar.GetRuntimeID()); if (Singleton <LevelManager> .Instance.levelActor.levelMode == LevelActor.Mode.Single) { Singleton <LevelManager> .Instance.levelActor.abilityPlugin.AddOrGetAbilityAndTriggerOnTarget(AbilityData.GetAbilityConfig("Level_AvatarReviveInvincible"), firstAliveAvatar.GetRuntimeID(), 2f); } } else { Singleton <WwiseAudioManager> .Instance.Post("BGM_PauseMenu_On", null, null, null); if (Singleton <LevelScoreManager> .Instance.LevelType == 4) { Singleton <LevelManager> .Instance.SetPause(false); Singleton <EventManager> .Instance.FireEvent(new EvtLevelState(EvtLevelState.State.EndLose, EvtLevelState.LevelEndReason.EndLoseAllDead, 0), MPEventDispatchMode.Normal); Singleton <CameraManager> .Instance.GetMainCamera().SetFailPostFX(true); } else if (Singleton <LevelDesignManager> .Instance.state == LevelDesignManager.LDState.Running) { Singleton <LevelManager> .Instance.SetPause(true); Singleton <MainUIManager> .Instance.ShowDialog(new InLevelReviveDialogContext(Singleton <AvatarManager> .Instance.GetTeamLeader().GetRuntimeID(), diedAvatar.XZPosition, true), UIType.Any); Singleton <CameraManager> .Instance.GetMainCamera().SetFailPostFX(true); } } }
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 uint CreateAvatar(AvatarDataItem avatarDataItem, bool isLocal, Vector3 initPos, Vector3 initDir, uint runtimeID, bool isLeader, bool leaderSkillOn, bool isHelper = false, bool useLow = false) { BaseMonoAvatar component = null; string avatarRegistryKey = avatarDataItem.AvatarRegistryKey; GameObject obj2 = null; int index = -1; for (int i = 0; i < this._preloadedAvatar.Count; i++) { if (this._preloadedAvatar[i].Item1 == avatarRegistryKey) { obj2 = this._preloadedAvatar[i].Item2; index = i; break; } } if (obj2 != null) { obj2.GetComponent <BaseMonoAvatar>().Enable(); this._preloadedAvatar.RemoveAt(index); } else { useLow = useLow || (!GlobalVars.AVATAR_USE_DYNAMIC_BONE || (Singleton <LevelManager> .Instance.levelActor.levelMode == LevelActor.Mode.Multi)); obj2 = (GameObject)UnityEngine.Object.Instantiate(Miscs.LoadResource <GameObject>(AvatarData.GetPrefabResPath(avatarRegistryKey, useLow), BundleType.RESOURCE_FILE), InLevelData.CREATE_INIT_POS, Quaternion.Euler(0f, 200f, 0f)); } component = obj2.GetComponent <BaseMonoAvatar>(); if (runtimeID == 0) { runtimeID = Singleton <RuntimeIDManager> .Instance.GetNextRuntimeID(3); } component.Init(isLocal, runtimeID, avatarDataItem.AvatarRegistryKey, avatarDataItem.GetWeapon().ID, initPos, initDir, isLeader); bool isPlayerAvatar = !isHelper; this.RegisterAvatar(component, isLocal, isPlayerAvatar, isHelper); AvatarActor actor = Singleton <EventManager> .Instance.CreateActor <AvatarActor>(component); actor.InitAvatarDataItem(avatarDataItem, isLocal, isHelper, isLeader, leaderSkillOn); actor.InitGalTouchBuff(avatarDataItem); actor.PostInit(); if (Singleton <LevelScoreManager> .Instance.LevelType == 4) { EndlessAvatarHp endlessAvatarHPData = Singleton <EndlessModule> .Instance.GetEndlessAvatarHPData(avatarDataItem.avatarID); actor.HP = (actor.maxHP * endlessAvatarHPData.get_hp_percent()) / 100f; actor.SP = (actor.maxSP * endlessAvatarHPData.get_sp_percent()) / 100f; } ConfigAvatar config = component.config; for (int j = 0; j < config.CommonArguments.PreloadEffectPatternGroups.Length; j++) { Singleton <EffectManager> .Instance.PreloadEffectGroup(config.CommonArguments.PreloadEffectPatternGroups[j], false); } if (component is MonoBronya) { if (actor.HasAppliedAbilityName("Weapon_Additional_BronyaLaser")) { Singleton <EffectManager> .Instance.PreloadEffectGroup("Bronya_Laser_Effects", false); } else { Singleton <EffectManager> .Instance.PreloadEffectGroup("Bronya_Gun_Effects", false); } } for (int k = 0; k < config.CommonArguments.RequestSoundBankNames.Length; k++) { Singleton <WwiseAudioManager> .Instance.ManualPrepareBank(config.CommonArguments.RequestSoundBankNames[k]); } return(component.GetRuntimeID()); }
public void OnClick() { if (this.canChange) { BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar(); if (this._avatar.IsAlive()) { if ((!this._avatar.IsControlMuted() && localAvatar.IsAnimatorInTag(AvatarData.AvatarTagGroup.AllowTriggerInput)) && (localAvatar.GetRuntimeID() != this.avatarRuntimeID)) { Singleton <LevelManager> .Instance.levelActor.TriggerSwapLocalAvatar(localAvatar.GetRuntimeID(), this.avatarRuntimeID, false); } } else if (Singleton <LevelScoreManager> .Instance.LevelType != 4) { Singleton <LevelManager> .Instance.SetPause(true); if (Singleton <LevelManager> .Instance.levelActor.levelMode == LevelActor.Mode.Single) { Singleton <MainUIManager> .Instance.ShowDialog(new InLevelReviveDialogContext(this.avatarRuntimeID, localAvatar.transform.position, false), UIType.Any); } else if ((Singleton <LevelManager> .Instance.levelActor.levelMode == LevelActor.Mode.Multi) || (Singleton <LevelManager> .Instance.levelActor.levelMode == LevelActor.Mode.MultiRemote)) { Singleton <MainUIManager> .Instance.ShowDialog(new InLevelReviveDialogContext(this.avatarRuntimeID, this._avatar.transform.position, false), UIType.Any); } } } }
public override void OnStart() { this._attackState = AttackState.NONE; BaseMonoAvatar attackTarget = this._aiEntity.AttackTarget as BaseMonoAvatar; if (attackTarget == null) { this._isTargetLocalAvatar = false; } else { this._isTargetLocalAvatar = Singleton <AvatarManager> .Instance.IsLocalAvatar(attackTarget.GetRuntimeID()); } if (this._isTargetLocalAvatar && this.AvatarBeAttackNum.IsShared) { this._levelAIPlugin.AddAttackingMonster(base.GetComponent <BaseMonoMonster>()); } if (this.SteerToTargetOnStart || ((this.SkillIDs != null) && (this.SkillIDs.Length > 0))) { this._abilityEntity.onCurrentSkillIDChanged = (Action <string, string>)Delegate.Combine(this._abilityEntity.onCurrentSkillIDChanged, new Action <string, string>(this.MonsterSkillIDChanged)); this._skillIDIx = -1; this._hasSteeredToFacing = this.SteerToTargetOnStart; } this._abilityEntity.onBeHitCanceled = (Action <string>)Delegate.Combine(this._abilityEntity.onBeHitCanceled, new Action <string>(this.MonsterBeHitCanceld)); if (this.HitSuccess.IsShared) { this.HitSuccess.SetValue(false); } }
private bool OnAvatarCreated(EvtAvatarCreated evt) { BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar(); AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(localAvatar.GetRuntimeID()); if (actor != null) { actor.AddAbilityState(AbilityState.Undamagable, true); } return(false); }
public override TaskStatus OnUpdate() { BaseMonoAvatar attackTarget = this._aiEntity.AttackTarget as BaseMonoAvatar; if (attackTarget == null) { this._isTargetLocalAvatar = false; } else { this._isTargetLocalAvatar = Singleton <AvatarManager> .Instance.IsLocalAvatar(attackTarget.GetRuntimeID()); } if (this._isTargetLocalAvatar) { if (this.attackType == SetType.BEGIN) { this._levelAIPlugin.AddAttackingMonster(this.monster); this.IsAttacking.Value = true; } else { this._levelAIPlugin.RemoveAttackingMonster(this.monster); this.IsAttacking.Value = false; } } return(TaskStatus.Success); }
public override void OnStart() { this._monster.onCurrentSkillIDChanged = (Action <string, string>)Delegate.Combine(this._monster.onCurrentSkillIDChanged, new Action <string, string>(this.MonsterSkillIDChanged)); this._monster.onBeHitCanceled = (Action <string>)Delegate.Combine(this._monster.onBeHitCanceled, new Action <string>(this.MonsterBeHitCanceled)); this._waitAttackTimer = 0f; this._skillIx = 0; this._state = State.WaitAttackStart; BaseMonoAvatar attackTarget = this._monster.AttackTarget as BaseMonoAvatar; if ((attackTarget != null) && Singleton <AvatarManager> .Instance.IsLocalAvatar(attackTarget.GetRuntimeID())) { if (this.AvatarBeAttackNum.IsShared) { this._levelAIPlugin.AddAttackingMonster(base.GetComponent <BaseMonoMonster>()); } this._isTargetLocalAvatar = true; } this.DoCalcSteer(); this.DoAttack(); if (this.HitSuccess.IsShared) { this.HitSuccess.SetValue(false); } }
public void SetupNatureBonus() { BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar(); EntityNature attribute = (EntityNature)Singleton <EventManager> .Instance.GetActor <AvatarActor>(localAvatar.GetRuntimeID()).avatarDataItem.Attribute; EntityNature nature = (EntityNature)this._currentMonster.metaConfig.nature; int natureBonusType = DamageModelLogic.GetNatureBonusType(attribute, nature); base.transform.Find("DamageMark/Up").gameObject.SetActive(natureBonusType == 1); base.transform.Find("DamageMark/Down").gameObject.SetActive(natureBonusType == -1); }