Esempio n. 1
0
        //进入战场
        public void EnterBattleField(BattleField battleField, GridUnit bornGrid)
        {
            if (battleField != null && bornGrid != null)
            {
                this.battleField = battleField;

                //设置敌方队伍
                enemyTeam = battleField.GetBattleTeam(this, false);

                //重置属性
                battleUnitAttribute.RandomAttributes();
                battleUnitAttribute.Reset();
                //重置bbsys
                battleBehaviourSystem.ResetSystem();

                EnterGrid(bornGrid);

                BattleUnitAction battleUnitAction = BattleUnitAction.Create(this);
                battleUnitAction.enterBattleFieldAction                         = BattleUnitEnterBattleFieldAction.Get();
                battleUnitAction.enterBattleFieldAction.bornGrid                = bornGrid;
                battleUnitAction.enterBattleFieldAction.attribute               = new BattleUnitSyncAttribute();
                battleUnitAction.enterBattleFieldAction.attribute.hpChanged     = 0;
                battleUnitAction.enterBattleFieldAction.attribute.currentHP     = battleUnitAttribute.hp;
                battleUnitAction.enterBattleFieldAction.attribute.energyChanged = 0;
                battleUnitAction.enterBattleFieldAction.attribute.currentEnergy = 0;

                //创建进入战场的消息
                battleField.AppendBattleAction(battleUnitAction);

                //初始化战斗行为系统
                battleBehaviourSystem.Init(this, battleField);
            }
        }
Esempio n. 2
0
        //进入战场
        public void EnterBattleField(BattleField battleField, GridUnit bornGrid)
        {
            if (battleField != null && bornGrid != null)
            {
                this.battleField = battleField;

                //设置敌方队伍
                enemyTeam = battleField.GetBattleTeam(this, false);

                //重置属性
                battleUnitAttribute.RandomAttributes();
                battleUnitAttribute.Reset();

                //创建背包
                if (package == null)
                {
                    package = BattleUnitPackage.CreateInstance(this, 2);
                }

                package.Clear();

                //进入战场
                BattleUnitEnterBattleFieldAction enterBattleFieldAction = BattleUnitActionEvent.CreateEvent <BattleUnitEnterBattleFieldAction>(BattleUnitActionType.EnterBattleField, this);
                enterBattleFieldAction.battleField             = battleField;
                enterBattleFieldAction.bornGrid                = bornGrid;
                enterBattleFieldAction.attribute               = new BattleUnitSyncAttribute();
                enterBattleFieldAction.attribute.hpChanged     = 0;
                enterBattleFieldAction.attribute.currentHP     = battleUnitAttribute.hp;
                enterBattleFieldAction.attribute.energyChanged = 0;
                enterBattleFieldAction.attribute.currentEnergy = 0;
                battleField.AppendBattleAction(enterBattleFieldAction);

                //进入格子
                EnterGrid(bornGrid);

                //初始化战斗行为系统
                if (battleBehaviourSystem != null)
                {
                    battleBehaviourSystem.Init(this, battleField);
                }

                //重置bbsys
                if (battleBehaviourSystem != null)
                {
                    battleBehaviourSystem.ResetSystem();
                }
            }
        }