Ejemplo n.º 1
0
        public void Update(GameTime gt)
        {
            KeyboardState kState = Keyboard.GetState();

            Debug.Update(gt, Mouse);

            if (Time >= TurnTime)
            {
                Time = 0f;
                SwitchTeam();
            }

            Time += (float)gt.ElapsedGameTime.TotalSeconds;

            if (Keyboard.GetState().IsKeyDown(Keys.R) && Mouse.CanPress)
            {
                StartGame();
            }

            World.Update(gt);

            CurrentTeam.Update(gt);

            EndTurnButton.Update(gt);

            if (TeamPopup != null)
            {
                TeamPopup.Update(gt);

                if (TeamPopup.Finished)
                {
                    TeamPopup = null;
                }
            }
        }
Ejemplo n.º 2
0
        public void SwitchTeam()
        {
            CurrentTeam.Increase();

            int index = Array.IndexOf(Teams, CurrentTeam);

            if (index + 1 > Teams.Length - 1)
            {
                CurrentTeam = Teams[0];
            }
            else
            {
                CurrentTeam = Teams[index + 1];
            }

            CurrentTeam.Time = 0;
            Time             = 0;
            CurrentTeam.Cards.ForEach(x => x.Position = x.HoverPosition + new Vector2(0, Utilities.Next(0, 60)));

            foreach (Unit u in World.Units)
            {
                if (u.Team == CurrentTeam)
                {
                    u.ReplenishMoves();
                }
            }

            TeamPopup = new Popup(CurrentTeam.Color, 15, 1);

            Camera.Position = CurrentTeam.Base.Position - new Vector2(Graphics.PreferredBackBufferWidth / 2 - (CurrentTeam.Base.SpriteSize.X * Cell) / 2, Graphics.PreferredBackBufferHeight / 2 - (CurrentTeam.Base.SpriteSize.Y * Cell) / 2);
        }
Ejemplo n.º 3
0
 private void UpdateImage()
 {
     Material = new Material(ShaderFlags.Position2DColoredTextured, TreeImageName[Level - 1]);
     Color    = CurrentTeam.ToColor();
     DrawArea =
         Rectangle.FromCenter(Center, GameLogic.TreeSize * Material.DiffuseMap.PixelSize / 1920.0f);
     NumberText.Center = Center + NumberTextPositionPerLevel[Level - 1];
 }
Ejemplo n.º 4
0
 void AdvanceTurn()
 {
     CurrentPlayer.isTurn      = false;
     CurrentPlayer.PreTurnEnd -= PreTurnEnd;
     CurrentPlayer.TurnEnd    -= TurnEnd;
     NextTeam();
     CurrentTeam.NextPlayer();
 }
Ejemplo n.º 5
0
 private void ChangeCurrentTeam()
 {
     currentTeam = CurrentTeam.Red;
     haveATeam   = true;
     this.GetComponent <Renderer>().material.color = redTeamColor;
     CancelInvoke("BuildUnit");
     InvokeRepeating("BuildUnit", 0, enemySpawnRate);
 }
Ejemplo n.º 6
0
 //TODO: set current team before match begins!!!!
 public void PointFor(CurrentTeam team)
 {
     if (currentTeam == CurrentTeam.Opponent && team == CurrentTeam.Team)
     {
         RotatePlayers();
     }
     currentTeam = team;
 }
Ejemplo n.º 7
0
 public static CurrentTeam GetTeam(Team teamDb)
 {
     return(new CurrentTeam()
     {
         Id = teamDb.TeamId,
         Name = teamDb.Name,
         Phone = teamDb.Phone,
         Photos = CurrentTeam.PhotosHelper(teamDb.TeamPhoto),
         Presence = CurrentTeam.PresenceHelper(teamDb.Group)
     });
 }
Ejemplo n.º 8
0
 public static List <CurrentTeam> GetTeams(IEnumerable <Team> teamsDb)
 {
     return(teamsDb.Select(t => new CurrentTeam()
     {
         Id = t.TeamId,
         Name = t.Name,
         Phone = t.Phone,
         Photos = CurrentTeam.PhotosHelper(t.TeamPhoto),
         Presence = CurrentTeam.PresenceHelper(t.Group)
     })
            .ToList());
 }
Ejemplo n.º 9
0
        public void Draw(SpriteBatch sb)
        {
            World.Draw(sb);

            CurrentTeam.Draw(sb);
            EndTurnButton.Position = new Vector2(Graphics.PreferredBackBufferWidth - EndTurnButton.Background.Width - Padding, Graphics.PreferredBackBufferHeight - EndTurnButton.Background.Height - Padding);

            EndTurnButton.Draw(sb);

            if (TeamPopup != null)
            {
                TeamPopup.Draw(sb);
            }
        }