Пример #1
0
 public EnemyGages(string name, GUIComponent parent, EnemyObject enemyObject) : base(name, parent, 0, 0)
 {
     this.enemyObject = enemyObject;
     gageTexture      = Global.content.Load <Texture2D>("EnemyGages");
 }
Пример #2
0
        public override void Update(GameTime gameTime)
        {
            if (transforming) // Starting
            {
                timespan++;
                if (timespan > TRANSFORMING_TIME)
                {
                    #region Summon Enemy and Hero objects.
                    foreach (Enemy enemy in combat.enemyFrontList)
                    {
                        EnemyObject enemyObject = new EnemyObject(0, 0, enemy, FighterState.Front, Global.soulBox.GetRandomHeros(1, enemy.soulCount));
                        guiLayer.AddGUI(new EnemyGages(enemy.name + "Gages", null, enemyObject));
                        stage.AddFighterObject(enemyObject);
                    }
                    foreach (Enemy enemy in combat.enemyBehindList)
                    {
                        EnemyObject enemyObject = new EnemyObject(0, 0, enemy, FighterState.Behind, Global.soulBox.GetRandomHeros(1, enemy.soulCount));
                        guiLayer.AddGUI(new EnemyGages(enemy.name + "Gages", null, enemyObject));
                        stage.AddFighterObject(enemyObject);
                    }
                    foreach (Hero hero in player.heros)
                    {
                        if (hero.defaultFighterState == FighterState.Stored)
                        {
                            continue;
                        }
                        HeroObject heroObject = new HeroObject(0, 0, hero);
                        guiLayer.AddGUI(new HeroGages(hero.name + "Gages", null, heroObject));
                        stage.AddFighterObject(heroObject);
                    }
                    SetFighterObjects();
                    #endregion
                    #region Set Selector
                    int i = 0;
                    foreach (ISelectable element in actionMenu.GetChild())
                    {
                        selector.SetItemToMatrix("ActionMenuGroup", element, i++, 0);
                    }
                    selector.SetItemToMatrix("ActionSelectGroup", actionSelect, 0, 0);

                    SetFighterGroupMatrix();
                    #endregion

                    transforming = false;
                    timePaused   = false;
                }
                else
                {
                    Global.camera.offsetY += (float)PLAYEROFFSET_Y / TRANSFORMING_TIME;
                }
            }
            else // Battle Started.
            {
                if (timePaused)
                {
                    // If targetBuffer is filled, do current action.
                    if (targetBuffer.Count > 0 && targetBufferFilled)
                    {
                        currentAction?.Execute(stage, actingFighterObject, targetBuffer, SummonFighterObject);
                        actionMenu.Deactivate();
                        actionSelect.Deactivate();
                        instruction.Deactivate();
                        selector.Reset();
                        targetBufferFilled = false;
                        return;
                    }
                    KeyCheck();
                }
                else
                {
                    // Buff trigger check.
                    foreach (FighterObject fighterObject in stage)
                    {
                        foreach (Buff buff in fighterObject.buffList)
                        {
                            string method = buff.TriggerCheck();
                            if (method != "")
                            {
                                readiedBuff.Enqueue(new BuffAction(buff, method));
                            }
                        }
                    }

                    if (readiedBuff.Count > 0)
                    {
                        timePaused = true;
                        BuffAction buffAction = readiedBuff.Dequeue();

                        switch (buffAction.method)
                        {
                        case "Start": buffAction.buff.Start(SummonFighterObject); break;

                        case "Finish": buffAction.buff.Finish(SummonFighterObject); break;

                        case "Attack": buffAction.buff.Attack(SummonFighterObject); break;

                        case "Hit": buffAction.buff.Hit(SummonFighterObject); break;

                        case "Ready": buffAction.buff.Ready(SummonFighterObject); break;

                        case "Tick": buffAction.buff.Tick(SummonFighterObject); break;
                        }
                    }
                    else if (readiedFighterObjects.Count > 0)
                    {
                        timePaused          = true;
                        actingFighterObject = readiedFighterObjects.Dequeue();
                        // Check if fighter is paused.
                        while (actingFighterObject.paused)
                        {
                            actingFighterObject = readiedFighterObjects.Dequeue();
                        }

                        if (actingFighterObject.fighter is Hero)
                        {
                            ActionMenuEnable((HeroObject)actingFighterObject);
                        }

                        if (actingFighterObject is EnemyObject)
                        {
                            EnemySkill enemySkill = ((EnemyObject)actingFighterObject).GetAction();
                            enemySkill.Execute(stage, actingFighterObject, enemySkill.SelectTarget(stage), SummonFighterObject);
                        }
                    }
                    else // Time goes here.
                    {
                        foreach (FighterObject fighterObject in stage)
                        {
                            if (fighterObject == null)
                            {
                                continue;
                            }

                            if (fighterObject.IncreaseGage(60))
                            {
                                readiedFighterObjects.Enqueue(fighterObject);
                            }

                            foreach (Buff buff in fighterObject.buffList)
                            {
                                buff.Update(gameTime);
                            }
                        }
                    }
                }
            }
            base.Update(gameTime);
        }