Exemplo n.º 1
0
        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]);
            }
        }
Exemplo n.º 2
0
        public override void Init(BaseMonoEntity entity)
        {
            this.monster         = (BaseMonoMonster)entity;
            base.runtimeID       = this.monster.GetRuntimeID();
            this.uniqueMonsterID = this.monster.uniqueMonsterID;
            string configType = string.Empty;

            if (this.uniqueMonsterID != 0)
            {
                configType = MonsterData.GetUniqueMonsterMetaData(this.uniqueMonsterID).configType;
            }
            this.config       = MonsterData.GetMonsterConfig(this.monster.MonsterName, this.monster.TypeName, configType);
            base.commonConfig = this.config.CommonConfig;
            this.metaConfig   = MonsterData.GetMonsterConfigMetaData(this.monster.MonsterName, this.monster.TypeName);
            base.Init(entity);
            Singleton <EventManager> .Instance.FireEvent(new EvtMonsterCreated(base.runtimeID), MPEventDispatchMode.Normal);

            this._paralyzeTimer = new EntityTimer();
            this._paralyzeTimer.SetActive(false);
            this._paralyzeState = ParalyzeState.Idle;
            base.AddPlugin(new MonsterAIPlugin(this));
            this.InitAbilityStateImmune();
            this.InitDebuffDurationRatio();
        }