Exemple #1
0
        protected async override Task ExecuteAsync()
        {
            Console.WriteLine("Starting Herd");


            var herd = new Shepherd(Root.Connection, "", worldKey: World);

            var configMonster = new ConfigMonster();

            configMonster.Configure(File);

            var baseMonsterType = Type.GetType(configMonster.RobotType);

            var parent = Activator.CreateInstance(baseMonsterType, herd) as ConfigMonster;

            if (File != null)
            {
                parent.Configure(File);
            }

            await herd.StartRobot(parent);

            await parent.SpawnAsync();

            Console.ReadLine();
        }
Exemple #2
0
    public Monster(int monsterId)
    {
        ConfigMonster monster = ConfigManager.Instance.ReqMonster(monsterId);

        if (monster != null)
        {
            _name         = monster._name;
            _desc         = monster._desc;
            _hp           = monster._hp;
            _def          = monster._def;
            _atk          = monster._atk;
            _power        = monster._power;
            _agile        = monster._agile;
            _physic       = monster._physic;
            _charm        = monster._charm;
            _perception   = monster._perception;
            _buffID       = 0;
            _buffDuration = 0;
            _dropId       = monster._drop;
        }
        else
        {
            MyLog.LogError("Monster " + monsterId + " not exist.");
        }
    }
Exemple #3
0
 public PreloadMonsterItem(string name, GameObject gameObj, ConfigMonster config)
 {
     this.name     = name;
     this.gameObj  = gameObj;
     this.config   = config;
     this.occupied = true;
 }
Exemple #4
0
    ConfigMonster InitTestData(int id)
    {
        var result = new ConfigMonster();

        result.id = id;
        return(result);
    }
Exemple #5
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]);
            }
        }
Exemple #6
0
    public void Create()
    {
        ConfigMonster player = ConfigManager.Instance.ReqMonster(GameConfig.PLAYER_CONFIG_ID);

        if (player != null)
        {
            _healthy = GameConfig.PLAYER_BASE_HEALTHY;
            _energy  = GameConfig.PLAYER_BASE_ENERGY;
            _hungry  = GameConfig.PLAYER_BASE_HUNGRY;

            _hp         = player._hp;
            _baseHp     = player._hp;
            _def        = player._def;
            _atk        = player._atk;
            _power      = player._power;
            _agile      = player._agile;
            _physic     = player._physic;
            _charm      = player._charm;
            _perception = player._perception;

            _buffID       = 0;
            _buffDuration = 0;

            _status = PlayerBattleStatus.Balance;

            _gold  = 0;
            _items = new List <ItemData>();
            EquipmentData equip = new EquipmentData(1);
            _equipmentList = new List <EquipmentData>();
        }
        else
        {
            MyLog.LogError("Player config data is null.");
        }
    }
Exemple #7
0
 public static ConfigMonster GetInstance()
 {
     if (instance != null)
     {
         return(instance);
     }
     instance = new ConfigMonster();
     return(instance);
 }
Exemple #8
0
        public static string GetMonsterBodyResPath(long typeID)
        {
            string resPath   = MonsterResPath + "/monster_" + typeID;
            int    bodyResID = ConfigMonster.GetInstance().GetBodyResID(typeID);

            if (bodyResID == 0)
            {
                Debug.LogWarning("ResPath:GetMonsterBodyResPath monster body res id 0, typeID:" + typeID);
                return(string.Empty);
            }
            string bodyPath = resPath + "/model_clothe_" + bodyResID + ".prefab";

            return(bodyPath);
        }
Exemple #9
0
        public static string GetPrefabResPath(string monsterName, string typeName, bool useLow = false)
        {
            MonsterConfigMetaData monsterConfigMetaDataByKey = MonsterConfigMetaDataReader.GetMonsterConfigMetaDataByKey(monsterName, typeName);
            string        categoryName = monsterConfigMetaDataByKey.categoryName;
            string        subTypeName  = monsterConfigMetaDataByKey.subTypeName;
            ConfigMonster monster      = GetMonsterConfig(monsterConfigMetaDataByKey.monsterName, monsterConfigMetaDataByKey.typeName, string.Empty);

            if (useLow && monster.CommonArguments.HasLowPrefab)
            {
                string[] textArray1 = new string[] { "Entities/Monster/", categoryName, "/", subTypeName, "/", subTypeName, "_Low" };
                return(string.Concat(textArray1));
            }
            string[] textArray2 = new string[] { "Entities/Monster/", categoryName, "/", subTypeName, "/", subTypeName };
            return(string.Concat(textArray2));
        }
Exemple #10
0
        private async Task <ConfigMonster> StartRobotType(string type)
        {
            var configMonster = new ConfigMonster();

            configMonster.Configure(RobotTypes[type]);

            var baseMonsterType = Type.GetType(configMonster.RobotType);

            var robot = Activator.CreateInstance(baseMonsterType, this) as ConfigMonster;

            robot.Configure(RobotTypes[type]);
            robot.SensorAllies.AlliedNames.Add(robot.Name);
            await StartRobot(robot);

            return(robot);
        }
Exemple #11
0
 public void LoadConfigs()
 {
     foreach (string path in ResourcesManager.CsvDict.Keys)
     {
         ReadCsv config = ResourcesManager.CsvDict[path];
         for (int i = 3; i < config.GetRow(); i++)
         {
             if (path.Contains("Scene.csv"))
             {
                 ConfigScene data = new ConfigScene(config, i);
                 this.CfgScene.Add(data._id, data);
             }
             else if (path.Contains("Story.csv"))
             {
                 ConfigStory data = new ConfigStory(config, i);
                 this.CfgStory.Add(data._id, data);
             }
             else if (path.Contains("Event.csv"))
             {
                 ConfigEvent data = new ConfigEvent(config, i);
                 this.CfgEvent.Add(data._id, data);
             }
             else if (path.Contains("Item.csv"))
             {
                 ConfigItem data = new ConfigItem(config, i);
                 this.CfgItem.Add(data._id, data);
             }
             else if (path.Contains("Drop.csv"))
             {
                 ConfigDrop data = new ConfigDrop(config, i);
                 this.CfgDrop.Add(data._id, data);
             }
             else if (path.Contains("Monster.csv"))
             {
                 ConfigMonster data = new ConfigMonster(config, i);
                 this.CfgMonster.Add(data._id, data);
             }
             else if (path.Contains("Equipment.csv"))
             {
                 ConfigEquipment data = new ConfigEquipment(config, i);
                 this.CfgEquipment.Add(data._id, data);
             }
         }
     }
 }
Exemple #12
0
    public void CreateHistory(SavedData savedData)
    {
        _healthy = savedData.role.healthy;
        _energy  = savedData.role.energy;
        _hungry  = savedData.role.hungry;

        _hp = savedData.role.hp;
        ConfigMonster player = ConfigManager.Instance.ReqMonster(GameConfig.PLAYER_CONFIG_ID);

        _baseHp       = player != null ? player._hp : 0;
        _def          = savedData.role.def;
        _atk          = savedData.role.atk;
        _power        = savedData.role.power;
        _agile        = savedData.role.agile;
        _physic       = savedData.role.physic;
        _charm        = savedData.role.charm;
        _perception   = savedData.role.perception;
        _buffID       = savedData.role.buffId;
        _buffDuration = savedData.role.buffDuration;

        _status = PlayerBattleStatus.Balance;

        _gold = savedData.gold;

        _items = new List <ItemData>();
        for (int i = 0; i < savedData.itemList.Count; i++)
        {
            ItemData data = new ItemData(savedData.itemList[i].id);
            data.Count = savedData.itemList[i].num;
            _items.Add(data);
        }

        _equipmentList = new List <EquipmentData>();
        for (int i = 0; i < savedData.equipmentList.Count; i++)
        {
            EquipmentData data = new EquipmentData(savedData.equipmentList[i].id);
            data.Lev = savedData.equipmentList[i].num;
            _equipmentList.Add(data);
        }
    }
Exemple #13
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();
        }
Exemple #14
0
 public Task OnSheepDeath(ConfigMonster sheep)
 {
     Console.WriteLine("one of the flock died of dysentery");
     return(Task.CompletedTask);
 }
Exemple #15
0
 public void Init(int id)
 {
     _configMonster = InitTestData(id);
 }