예제 #1
0
        public void UpdateBattleUnitPackage(BattleUnitPackage battleUnitPackage, bool activeTrigger)
        {
            if (packageItems == null || packageItems.Count == 0)
            {
                return;
            }

            this.battleUnitPackage = battleUnitPackage;

            this.activeTrigger = activeTrigger;

            UpdateElement();
        }
예제 #2
0
        public static BattleUnitPackage CreateInstance(BattleUnit owner, int capaticy)
        {
            if (owner == null)
            {
                return(null);
            }

            BattleUnitPackage package = new BattleUnitPackage();

            package.owner    = owner;
            package.capacity = capaticy;

            return(package);
        }
예제 #3
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();
                }
            }
        }