예제 #1
0
        public override void DoRead(ByteReader BR)
        {
            ActivePlayerIndex = BR.ReadInt32();
            ActiveSquadIndex  = BR.ReadInt32();
            ActiveSquad       = Map.ListPlayer[ActivePlayerIndex].ListSquad[ActiveSquadIndex];
            ActiveSquad.CurrentLeader.AttackIndex = BR.ReadInt32();
            int AttackChoiceCount = BR.ReadInt32();

            ListAttackChoice  = new List <Vector3>(AttackChoiceCount);
            ListAttackTerrain = new List <MovementAlgorithmTile>(AttackChoiceCount);
            for (int A = 0; A < AttackChoiceCount; ++A)
            {
                Vector3 NewTerrain = new Vector3(BR.ReadFloat(), BR.ReadFloat(), BR.ReadInt32());
                ListAttackChoice.Add(NewTerrain);
                ListAttackTerrain.Add(Map.GetTerrain(NewTerrain.X, NewTerrain.Y, (int)NewTerrain.Z));
            }

            bool IsBattlePreviewOpen = BR.ReadBoolean();

            if (IsBattlePreviewOpen)
            {
                int PlayerIndex = BR.ReadInt32();
                int SquadIndex  = BR.ReadInt32();
                BattlePreview = new BattlePreviewer(Map, PlayerIndex, SquadIndex, null);
            }

            Map.CursorPosition = new Vector3(BR.ReadFloat(), BR.ReadFloat(), BR.ReadFloat());
        }
예제 #2
0
 public ActionPanelAttackMAPTargeted(DeathmatchMap Map, Squad ActiveSquad)
     : base("Attack MAP Targeted", Map)
 {
     this.ActiveSquad = ActiveSquad;
     CurrentAttack    = ActiveSquad.CurrentLeader.CurrentAttack;
     BattlePreview    = new BattlePreviewer(Map, ActiveSquad, ActiveSquad.CurrentLeader.CurrentAttack);
 }
예제 #3
0
 public ActionPanelAttackPart2(DeathmatchMap Map, Squad ActiveSquad, int ActivePlayerIndex)
     : base("Attack2", Map)
 {
     this.ActiveSquad       = ActiveSquad;
     this.ActivePlayerIndex = ActivePlayerIndex;
     BattlePreview          = new BattlePreviewer(Map, ActiveSquad, ActiveSquad.CurrentLeader.CurrentAttack);
 }
예제 #4
0
 public ActionPanelUseMAPAttack(DeathmatchMap Map, Squad ActiveSquad, int ActivePlayerIndex, List <Vector3> AttackChoice)
     : base("UseMapAttack", Map)
 {
     this.ActiveSquad       = ActiveSquad;
     this.ActivePlayerIndex = ActivePlayerIndex;
     this.AttackChoice      = AttackChoice;
     BattlePreview          = new BattlePreviewer(Map, ActiveSquad, ActiveSquad.CurrentLeader.CurrentAttack);
 }
예제 #5
0
 public ActionPanelAttackMAPSpread(DeathmatchMap Map, int ActivePlayerIndex, int ActiveSquadIndex)
     : base(PanelName, Map)
 {
     this.ActivePlayerIndex = ActivePlayerIndex;
     this.ActiveSquadIndex  = ActiveSquadIndex;
     ActiveSquad            = Map.ListPlayer[ActivePlayerIndex].ListSquad[ActiveSquadIndex];
     CurrentAttack          = ActiveSquad.CurrentLeader.CurrentAttack;
     BattlePreview          = new BattlePreviewer(Map, ActivePlayerIndex, ActiveSquadIndex, ActiveSquad.CurrentLeader.CurrentAttack);
 }
예제 #6
0
        public override void DoRead(ByteReader BR)
        {
            bool IsBattlePreviewOpen = BR.ReadBoolean();

            if (IsBattlePreviewOpen)
            {
                int PlayerIndex = BR.ReadInt32();
                int SquadIndex  = BR.ReadInt32();
                BattlePreview = new BattlePreviewer(Map, PlayerIndex, SquadIndex, null);
            }
        }
예제 #7
0
        public ActionPanelUseMAPAttack(DeathmatchMap Map, int ActivePlayerIndex, int ActiveSquadIndex, List <Vector3> AttackChoice)
            : base(PanelName, Map)
        {
            this.ActivePlayerIndex = ActivePlayerIndex;
            this.ActiveSquadIndex  = ActiveSquadIndex;
            this.ListAttackChoice  = AttackChoice;

            ActiveSquad   = Map.ListPlayer[ActivePlayerIndex].ListSquad[ActiveSquadIndex];
            CurrentAttack = ActiveSquad.CurrentLeader.CurrentAttack;
            BattlePreview = new BattlePreviewer(Map, ActivePlayerIndex, ActiveSquadIndex, ActiveSquad.CurrentLeader.CurrentAttack);
        }
예제 #8
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();
            }
        }
예제 #9
0
        public override void DoRead(ByteReader BR)
        {
            ActivePlayerIndex = BR.ReadInt32();
            ActiveSquadIndex  = BR.ReadInt32();
            ActiveSquad       = Map.ListPlayer[ActivePlayerIndex].ListSquad[ActiveSquadIndex];
            ActiveSquad.CurrentLeader.AttackIndex = BR.ReadInt32();
            int AttackChoiceCount = BR.ReadInt32();

            ListAttackChoice  = new List <Vector3>(AttackChoiceCount);
            ListAttackTerrain = new List <MovementAlgorithmTile>(AttackChoiceCount);
            for (int A = 0; A < AttackChoiceCount; ++A)
            {
                Vector3 NewTerrain = new Vector3(BR.ReadFloat(), BR.ReadFloat(), BR.ReadInt32());
                ListAttackChoice.Add(NewTerrain);
                ListAttackTerrain.Add(Map.GetTerrain(NewTerrain.X, NewTerrain.Y, (int)NewTerrain.Z));
            }

            CurrentAttack = ActiveSquad.CurrentLeader.CurrentAttack;
            Map.BattleMenuOffenseFormationChoice = FormationChoices.ALL;
            BattlePreview = new BattlePreviewer(Map, ActivePlayerIndex, ActiveSquadIndex, ActiveSquad.CurrentLeader.CurrentAttack);
        }
예제 #10
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();
            }
        }
예제 #11
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();
            }
        }