Пример #1
0
        /**
         * 計算每位角色所取得的經驗值
         * */
        private int GetEarnExp(IBattleGroup group)
        {
            int _exp = 0;
            //本次取得的全部經驗量
            group.DieMonster.ForEach(_monster => _exp += _monster.Exp);

            return _exp / group.Charactor.Count;
        }
Пример #2
0
 public BattleManager(IConfigurationFactory factory, IBattleGroup group)
 {
     _events = factory.GetEvents();
     _msgCollector = ServiceLocator.GetServiceLocator().GetService<IMsgCollector>();
     _group = group;
     _args = new BattleEventArgs(group);
     //建立戰鬥程序
     InitailBattleProcess();
 }
 private List<object> GetMsgData(IBattleGroup group)
 {
     List<object> _data = new List<object>();
     //資料整理
     foreach (ICharactorProperty charactor in group.Charactor)
     {
         _data.Add(new { charactor.Name, charactor.Hp });
     }
     return _data;
 }
Пример #4
0
        private List<object> GetMsgData(IBattleGroup group)
        {
            List<object> _data = new List<object>();
            //資料整理
            foreach (IMonsterProperty _monster in group.DieMonster)
            {
                _data.Add(_monster.Name);
            }

            return _data;
        }
        private List<object> GetMsgData(IBattleGroup group)
        {
            List<object> _data = new List<object>();
            //資料整理
            foreach (IMonsterProperty _monsterProperty in group.Monster)
            {
                object[] args = { _monsterProperty.Name, _monsterProperty.Hp };
                _data.Add(args);
            }

            return _data;
        }
Пример #6
0
        private List<object> GetMsgData(IBattleGroup group)
        {
            List<object> _data = new List<object>();
            //資料整理
            foreach (IMonsterProperty _peroperty in group.DieMonster)
            {
                List<string> itemList =
                    ObjectFactory.GetInstance<IMonsterProperty, MonsterBehavior>(_peroperty).DropItems();
                itemList.ForEach(item => _data.Add(item));
            }

            return _data;
        }
Пример #7
0
        /**
         * 角色取得經驗值
         * */
        private List<object> CharactorRaiseExp(IBattleGroup group, int earnExp)
        {
            List<object> _data = new List<object>();
            foreach (ICharactorProperty _charactor in group.Charactor)
            {
                _charactor.Exp += earnExp;
                while (CanUpgradeLV(_charactor))
                {
                    IMsgCollector _collector = Service.ServiceLocator.GetServiceLocator().GetService<IMsgCollector>();
                    ObjectFactory.GetInstance<ICharactorProperty, CharactorBehavior>(_charactor, _collector).UpgradeLevel();
                    //資料整理
                    object[] args = { _charactor.Name, _charactor.Lv };
                    _data.Add(args);
                }
            }

            return _data;
        }
Пример #8
0
 public BattleEventArgs(IBattleGroup battleGroup)
 {
     BattleGroup = battleGroup;
 }