Exemplo n.º 1
0
        /// <summary>
        /// バトル開始
        /// </summary>
        /// <returns></returns>
        public static AsyncSubject <List <LootItemStruct> > BootBattle()
        {
            AsyncSubject <List <LootItemStruct> > subject = new AsyncSubject <List <LootItemStruct> >();

            var dungeon = DungeonDictionary.GetDungeonMapData(DungeonDataModel.Instance.DungeonId);

            var enemies        = BattleLogic.EnemiesChoice();
            var enemyDataModel = EnemyDataModel.Instance;

            enemyDataModel.Initialize();
            enemies.Enemies.ForEach(enemyId =>
            {
                float level = Random.Range(dungeon.enemyLevel.min, dungeon.enemyLevel.max);
                level       = level * DungeonDataModel.Instance.Location.y + 1;
                level      += enemies.AddLevel;
                enemyDataModel.Add(EnemyLogic.Create(enemyId, (int)level));
            });

            _battleScene = Object.Instantiate((GameObject)Resources.Load("Prefabs/Scene/Battle"), Vector3.zero,
                                              Quaternion.identity);
            _battleScene.transform.Find("FrontCanvas").GetComponent <Canvas>().worldCamera =
                GameObject.Find("MainCamera").GetComponent <Camera>();

            var battleManager = _battleScene.transform.Find("System").GetComponent <BattleManager>();

            battleManager.Initialize();
            battleManager.EndBattle.Subscribe(loots =>
            {
                subject.OnNext(loots);
                subject.OnCompleted();
            });

            return(subject);
        }
Exemplo n.º 2
0
        private void Start()
        {
            LoadResources resources = new LoadResources();

            resources.Initialize();

            //アクターの作成とメンバーの追加
            ActorDataModel  actorData  = ActorDataModel.Instance;
            MemberDataModel memberData = MemberDataModel.Instance;

            memberData.Add(ActorLogic.Create("Mandrake", 3));
            memberData.Add(ActorLogic.Create("Slime", 3));
            memberData.Add(ActorLogic.Create("MechanicSoldier", 3));
            memberData.Add(ActorLogic.Create("Kyubi", 3));

            //エネミーの作成
            EnemyDataModel enemyData = EnemyDataModel.Instance;

            enemyData.Initialize();
            enemyData.Add(EnemyLogic.Create("Goblin", 3));
            enemyData.Add(EnemyLogic.Create("GreenDragon", 3));
            enemyData.Add(EnemyLogic.Create("Goblin", 4));

            //アイテム
            InventoryDataModel.GetInstance().StartUp();

            var manager = gameObject.GetComponent <BattleManager>();

            manager.Initialize();
        }