Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
        private void HandleAlreadyLoadedPrefabs()
        {
            RuntimeIDManager  instance         = Singleton <RuntimeIDManager> .Instance;
            StageEntry        stageEntryByName = StageData.GetStageEntryByName(this.stageDevData.stageName);
            MonoBasePerpStage perpStage        = UnityEngine.Object.FindObjectOfType <MonoBasePerpStage>();

            if (perpStage != null)
            {
                perpStage.Init(stageEntryByName, (string)null);
            }
            MonoStageEnv stageEnv = UnityEngine.Object.FindObjectOfType <MonoStageEnv>();

            Singleton <StageManager> .Instance.RegisterStage(stageEntryByName, perpStage, stageEnv);

            LevelActor actor = (LevelActor)Singleton <EventManager> .Instance.GetActor(0x21800001);

            actor.levelMode = this.LEVEL_MODE;
            BaseMonoAvatar avatar = UnityEngine.Object.FindObjectOfType <BaseMonoAvatar>();

            if (avatar != null)
            {
                DevAvatarData  devAvatarData  = this.avatarDevDatas[0];
                AvatarDataItem avatarDataItem = Singleton <AvatarModule> .Instance.GetDummyAvatarDataItem(this.avatarTypeNames[0], devAvatarData.avatarLevel, devAvatarData.avatarStar);

                this.SetUpAvatarDataItem(avatarDataItem, devAvatarData);
                uint nextRuntimeID = instance.GetNextRuntimeID(3);
                avatar.Init(true, nextRuntimeID, avatarDataItem.AvatarRegistryKey, avatarDataItem.GetWeapon().ID, avatar.transform.position, avatar.transform.forward, true);
                this.LoadAvatarWwiseSoundBank(avatar);
                AvatarActor actor2 = Singleton <EventManager> .Instance.CreateActor <AvatarActor>(avatar);

                actor2.InitAvatarDataItem(avatarDataItem, true, false, true, true);
                actor2.PostInit();
                Singleton <AvatarManager> .Instance.RegisterAvatar(avatar, true, true, false);

                this.SetUpAvatarSkill(actor2, devAvatarData);
                this.CheatForPariticleMode(actor2);
                for (int i = 1; i < this.avatarCount; i++)
                {
                    DevAvatarData  data2 = this.avatarDevDatas[i];
                    AvatarDataItem item2 = Singleton <AvatarModule> .Instance.GetDummyAvatarDataItem(this.avatarTypeNames[i], data2.avatarLevel, data2.avatarStar);

                    this.SetUpAvatarDataItem(item2, data2);
                    uint runtimeID = instance.GetNextRuntimeID(3);
                    Singleton <AvatarManager> .Instance.CreateAvatar(item2, false, avatar.XZPosition, avatar.FaceDirection, runtimeID, false, false, false, false);

                    AvatarActor actor3 = Singleton <EventManager> .Instance.GetActor <AvatarActor>(runtimeID);

                    this.SetUpAvatarSkill(actor3, data2);
                    this.CheatForPariticleMode(actor3);
                }
                if (this.useFakeHelper)
                {
                    this.CreateFakeFriendAvatar();
                }
                Singleton <CinemaDataManager> .Instance.Preload(avatar);
            }
            foreach (BaseMonoMonster monster in UnityEngine.Object.FindObjectsOfType <BaseMonoMonster>())
            {
                DevMonsterData data3      = null;
                int            instanceID = monster.gameObject.GetInstanceID();
                for (int j = 0; j < this.monsterInstanceIds.Count; j++)
                {
                    if (this.monsterInstanceIds[j] == instanceID)
                    {
                        data3 = this.monsterDevDatas[j];
                        break;
                    }
                }
                if (data3 == null)
                {
                    UnityEngine.Object.Destroy(monster.gameObject);
                }
                else
                {
                    string monsterName;
                    string typeName;
                    uint   num7 = instance.GetNextRuntimeID(4);
                    if (data3.uniqueMonsterID != 0)
                    {
                        UniqueMonsterMetaData uniqueMonsterMetaData = MonsterData.GetUniqueMonsterMetaData(data3.uniqueMonsterID);
                        monsterName = uniqueMonsterMetaData.monsterName;
                        typeName    = uniqueMonsterMetaData.typeName;
                    }
                    else
                    {
                        monsterName = data3.monsterName;
                        typeName    = data3.typeName;
                    }
                    bool isElite = data3.isElite;
                    monster.Init(monsterName, typeName, num7, monster.transform.position, data3.uniqueMonsterID, null, true, isElite, true, 0);
                    for (int k = 0; k < monster.config.CommonArguments.RequestSoundBankNames.Length; k++)
                    {
                        Singleton <WwiseAudioManager> .Instance.ManualPrepareBank(monster.config.CommonArguments.RequestSoundBankNames[k]);
                    }
                    MonsterActor actor4 = Singleton <EventManager> .Instance.CreateActor <MonsterActor>(monster);

                    actor4.InitLevelData(data3.level, data3.isElite);
                    actor4.PostInit();
                    Singleton <MonsterManager> .Instance.RegisterMonster(monster);

                    if (data3.abilities.Length > 0)
                    {
                        for (int m = 0; m < data3.abilities.Length; m++)
                        {
                            string str3 = data3.abilities[m];
                            if (!string.IsNullOrEmpty(str3))
                            {
                                actor4.abilityPlugin.InsertPreInitAbility(AbilityData.GetAbilityConfig(data3.abilities[m]));
                            }
                        }
                    }
                    if (data3.isStationary)
                    {
                        MonsterActor actor5 = Singleton <EventManager> .Instance.GetActor <MonsterActor>(monster.GetRuntimeID());

                        actor5.baseMaxHP = actor5.HP = actor5.maxHP = 999999f;
                        monster.GetActiveAIController().SetActive(false);
                    }
                }
            }
            Singleton <LevelManager> .Instance.levelActor.SuddenLevelStart();

            EvtStageReady evt = new EvtStageReady {
                isBorn = true
            };

            Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal);

            Singleton <DetourManager> .Instance.LoadNavMeshRelatedLevel(this.stageDevData.stageName);

            Singleton <MainUIManager> .Instance.GetInLevelUICanvas().FadeInStageTransitPanel(0.18f, false, null, null);
        }