예제 #1
0
        public override void DoUpdate(GameTime gameTime)
        {
            switch (ActiveSquad.CurrentLeader.CurrentAttack.MAPAttributes.Property)
            {
            case WeaponMAPProperties.Spread:
                if (InputHelper.InputConfirmPressed() || MouseHelper.InputLeftButtonReleased())
                {
                }
                else
                {
                    Map.CursorControl();    //Move the cursor
                }
                break;

            case WeaponMAPProperties.Direction:
                Map.SelectMAPEnemies(ActiveSquad, ActivePlayerIndex, AttackChoice);
                Map.sndConfirm.Play();
                break;

            case WeaponMAPProperties.Targeted:
                if (InputHelper.InputConfirmPressed() || MouseHelper.InputLeftButtonReleased())
                {
                    Map.SelectMAPEnemies(ActiveSquad, ActivePlayerIndex, AttackChoice);
                    Map.sndConfirm.Play();
                }
                else
                {
                    Map.CursorControl();    //Move the cursor
                    BattlePreview.UpdateUnitDisplay();
                }
                break;
            }
        }
예제 #2
0
        public override void DoUpdate(GameTime gameTime)
        {
            Map.ListLayer[Map.ActiveLayerIndex].LayerGrid.AddDrawablePoints(AttackChoice, Color.FromNonPremultiplied(255, 0, 0, 190));

            if (InputHelper.InputConfirmPressed() || MouseHelper.InputLeftButtonReleased())
            {
                if (AttackChoice.Contains(Map.CursorPosition))
                {
                    for (int X = 0; X < CurrentAttack.MAPAttributes.ListChoice.Count; X++)
                    {
                        for (int Y = 0; Y < CurrentAttack.MAPAttributes.ListChoice[X].Count; Y++)
                        {
                            if (CurrentAttack.MAPAttributes.ListChoice[X][Y])
                            {
                                AttackChoice.Add(new Vector3(Map.CursorPosition.X + X - CurrentAttack.MAPAttributes.Width,
                                                             Map.CursorPosition.Y + Y - CurrentAttack.MAPAttributes.Height, Map.CursorPosition.Z));
                            }
                        }
                    }

                    Map.sndConfirm.Play();
                }
                else
                {
                    Map.sndDeny.Play();
                }
            }
            else
            {
                Map.CursorControl();//Move the cursor
                BattlePreview.UpdateUnitDisplay();
            }
        }
예제 #3
0
        public override void DoUpdate(GameTime gameTime)
        {
            Map.LayerManager.AddDrawablePoints(ListAttackTerrain, Color.FromNonPremultiplied(255, 0, 0, 190));

            if (ActiveInputManager.InputConfirmPressed())
            {
                if (ListAttackChoice.Contains(Map.CursorPosition))
                {
                    for (int X = 0; X < CurrentAttack.MAPAttributes.ListChoice.Count; X++)
                    {
                        for (int Y = 0; Y < CurrentAttack.MAPAttributes.ListChoice[X].Count; Y++)
                        {
                            if (CurrentAttack.MAPAttributes.ListChoice[X][Y])
                            {
                                ListAttackChoice.Add(new Vector3(Map.CursorPosition.X + X - CurrentAttack.MAPAttributes.Width,
                                                                 Map.CursorPosition.Y + Y - CurrentAttack.MAPAttributes.Height, Map.CursorPosition.Z));
                            }
                        }
                    }

                    Map.sndConfirm.Play();
                }
                else
                {
                    Map.sndDeny.Play();
                }
            }
            else
            {
                Map.CursorControl(ActiveInputManager);//Move the cursor
                BattlePreview.UpdateUnitDisplay();
            }
        }
예제 #4
0
        public override void DoUpdate(GameTime gameTime)
        {
            Map.LayerManager.AddDrawablePoints(ListAttackTerrain, Color.FromNonPremultiplied(255, 0, 0, 190));

            if (ActiveInputManager.InputConfirmPressed())
            {
                CreateAttack(ActiveSquad.CurrentLeader.CurrentAttack);
                Map.sndConfirm.Play();
            }
            else
            {
                bool CursorMoved = Map.UpdateMapNavigation(ActiveInputManager);
                if (CursorMoved)
                {
                    BattlePreview = new BattlePreviewer(Map, ActivePlayerIndex, ActiveSquadIndex, ActiveSquad.CurrentLeader.CurrentAttack);
                }
                BattlePreview.UpdateUnitDisplay();
            }
        }
예제 #5
0
        public override void DoUpdate(GameTime gameTime)
        {
            if (ActiveInputManager.InputConfirmPressed())
            {
                if (ListAttackChoice.Contains(Map.CursorPosition))
                {
                    Map.SelectMAPEnemies(ActivePlayerIndex, ActiveSquadIndex, ListAttackChoice);
                    Map.sndConfirm.Play();
                }
                else
                {
                    Map.sndDeny.Play();
                }
            }
            else
            {
                Map.CursorControl(ActiveInputManager);//Move the cursor
                BattlePreview.UpdateUnitDisplay();
            }

            Map.LayerManager.AddDrawablePoints(ListAttackTerrain, Color.FromNonPremultiplied(255, 0, 0, 190));
        }
예제 #6
0
        public override void DoUpdate(GameTime gameTime)
        {
            if (InputHelper.InputConfirmPressed() || MouseHelper.InputLeftButtonReleased())
            {
                if (AttackChoice.Contains(Map.CursorPosition))
                {
                    Map.SelectMAPEnemies(ActiveSquad, ActivePlayerIndex, AttackChoice);
                    Map.sndConfirm.Play();
                }
                else
                {
                    Map.sndDeny.Play();
                }
            }
            else
            {
                Map.CursorControl();//Move the cursor
                BattlePreview.UpdateUnitDisplay();
            }

            Map.ListLayer[Map.ActiveLayerIndex].LayerGrid.AddDrawablePoints(AttackChoice, Color.FromNonPremultiplied(255, 0, 0, 190));
        }
예제 #7
0
        public override void DoUpdate(GameTime gameTime)
        {
            bool CursorMoved = Map.UpdateMapNavigation();

            if (CursorMoved)
            {
                BattlePreview = null;
            }
            //Loop through the players to find a Unit to control.
            for (int P = 0; P < Map.ListPlayer.Count; P++)
            {
                //Find if a current player Unit is under the cursor.
                int CursorSelect = Map.CheckForSquadAtPosition(P, Map.CursorPosition, Vector3.Zero);

                if (CursorSelect >= 0)
                {
                    if (BattlePreview == null)
                    {
                        BattlePreview = new BattlePreviewer(Map, Map.ListPlayer[P].ListSquad[CursorSelect], null);
                    }
                    BattlePreview.UpdateUnitDisplay();
                }
            }

            if (InputHelper.InputCancelPressed())
            {
                AddToPanelListAndSelect(Map.BattleMapMenu);

                Map.ActiveSquadIndex = -1;
                Map.sndConfirm.Play();
            }
            else if (InputHelper.InputConfirmPressed())
            {
                if (MouseHelper.InputLeftButtonReleased())
                {
                    if (MouseHelper.MouseStateCurrent.X < 0 || MouseHelper.MouseStateCurrent.X > Constants.Width ||
                        MouseHelper.MouseStateCurrent.Y < 0 || MouseHelper.MouseStateCurrent.Y > Constants.Height)
                    {
                        return;
                    }
                }

                Map.ActiveSquadIndex = -1;
                Map.TargetSquadIndex = -1;
                bool UnitFound = false;
                //Loop through the players to find a Unit to control.
                for (int P = 0; P < Map.ListPlayer.Count && (Map.ActiveSquadIndex < 0 && Map.TargetSquadIndex < 0); P++)
                {
                    //Find if a current player Unit is under the cursor.
                    int CursorSelect = Map.CheckForSquadAtPosition(P, Map.CursorPosition, Vector3.Zero);

                    #region Unit found

                    if (CursorSelect >= 0)
                    {
                        UnitFound = true;
                        ActionPanelMainMenu NewActionMenu = new ActionPanelMainMenu(Map, Map.ListPlayer[P].ListSquad[CursorSelect], P);
                        AddToPanelList(NewActionMenu);

                        if (P == Map.ActivePlayerIndex && Map.ListPlayer[P].ListSquad[CursorSelect].IsPlayerControlled)//Player controlled Squad.
                        {
                            NewActionMenu.OnSelect();
                        }
                        else//Enemy.
                        {
                            NewActionMenu.AddChoiceToCurrentPanel(new ActionPanelStatus(Map, Map.ListPlayer[P].ListSquad[CursorSelect]));
                        }
                    }

                    #endregion
                }

                //You select the tile under the cursor.
                if (!UnitFound)
                {
                    AddToPanelListAndSelect(new ActionPanelTileStatus(Map));
                }

                Map.sndConfirm.Play();
            }
        }
예제 #8
0
        public override void DoUpdate(GameTime gameTime)
        {
            Map.LayerManager.AddDrawablePoints(ListAttackTerrain, Color.FromNonPremultiplied(255, 0, 0, 190));

            if (ActiveInputManager.InputConfirmPressed())
            {
                int TargetSelect = 0;
                //Verify if the cursor is over one of the possible MV position.
                while ((Map.CursorPosition.X != ListAttackChoice[TargetSelect].X || Map.CursorPosition.Y != ListAttackChoice[TargetSelect].Y) &&
                       ++TargetSelect < ListAttackChoice.Count)
                {
                    ;
                }
                //If nothing was found.
                if (TargetSelect >= ListAttackChoice.Count)
                {
                    return;
                }

                Map.TargetSquadIndex = -1;

                for (int P = 0; P < Map.ListPlayer.Count; P++)
                {
                    //Find if a Unit is under the cursor.
                    TargetSelect = Map.CheckForSquadAtPosition(P, Map.CursorPosition, Vector3.Zero);
                    //If one was found.
                    if (TargetSelect >= 0)
                    {
                        if (Map.ListPlayer[ActivePlayerIndex].Team != Map.ListPlayer[P].Team)//If it's an ennemy.
                        {
                            ActiveSquad.CurrentLeader.CurrentAttack.UpdateAttack(ActiveSquad.CurrentLeader, ActiveSquad.Position, Map.CursorPosition,
                                                                                 ActiveSquad.ArrayMapSize, Map.ListPlayer[P].ListSquad[TargetSelect].CurrentMovement, ActiveSquad.CanMove);

                            if (!ActiveSquad.CurrentLeader.CurrentAttack.CanAttack)
                            {
                                Map.sndDeny.Play();
                                return;
                            }

                            Map.PrepareSquadsForBattle(ActivePlayerIndex, ActiveSquadIndex, P, TargetSelect);

                            SupportSquadHolder ActiveSquadSupport = new SupportSquadHolder();
                            ActiveSquadSupport.PrepareAttackSupport(Map, ActivePlayerIndex, ActiveSquad, P, TargetSelect);

                            SupportSquadHolder TargetSquadSupport = new SupportSquadHolder();
                            TargetSquadSupport.PrepareDefenceSupport(Map, P, Map.ListPlayer[P].ListSquad[TargetSelect]);

                            Map.ComputeTargetPlayerDefence(ActivePlayerIndex, ActiveSquadIndex, ActiveSquadSupport, P, TargetSelect, TargetSquadSupport);

                            break;
                        }
                    }
                }
                Map.sndConfirm.Play();
            }
            else
            {
                bool CursorMoved = Map.UpdateMapNavigation(ActiveInputManager);
                if (CursorMoved)
                {
                    BattlePreview = new BattlePreviewer(Map, ActivePlayerIndex, ActiveSquadIndex, ActiveSquad.CurrentLeader.CurrentAttack);
                }
                BattlePreview.UpdateUnitDisplay();
            }
        }