Example #1
0
        private void ResetArena()
        {
            SplatoonArena arena = ActiveArena as SplatoonArena;

            for (int x = (int)arena.ArenaTopLeft.X / 16; x <= (int)arena.ArenaBottomRight.X / 16; x++)
            {
                for (int y = (int)arena.ArenaTopLeft.Y / 16; y <= (int)arena.ArenaBottomRight.Y / 16; y++)
                {
                    var coord = new Vector2(x, y);

                    int tileColor = 0;
                    int wallColor = 0;
                    if (arena.PaintSpotTiles.ContainsKey(coord))
                    {
                        tileColor = arena.PaintSpotTiles[coord];
                    }
                    if (arena.PaintSpotWalls.ContainsKey(coord))
                    {
                        wallColor = arena.PaintSpotWalls[coord];
                    }

                    if (Terraria.Main.tile[x, y].color() != tileColor)
                    {
                        Terraria.Main.tile[x, y].color((byte)tileColor);
                    }

                    if (Terraria.Main.tile[x, y].wallColor() != wallColor)
                    {
                        Terraria.Main.tile[x, y].wallColor((byte)wallColor);
                    }
                }
            }

            ResetSection((int)arena.ArenaTopLeft.X / 16, (int)arena.ArenaBottomRight.X / 16, (int)arena.ArenaTopLeft.Y / 16, (int)arena.ArenaBottomRight.Y / 16);
        }
Example #2
0
        public override void StartGame()
        {
            SplatoonArena arena = ActiveArena as SplatoonArena;

            foreach (var player in Players)
            {
                if (RedTeam.Count < BlueTeam.Count)
                {
                    RedTeam.Add(player);
                    player.SetGamemodeSpawnPoint(arena.RedSpawn);
                    player.SetTeam(1);
                }
                else
                {
                    BlueTeam.Add(player);
                    player.SetGamemodeSpawnPoint(arena.BlueSpawn);
                    player.SetTeam(3);
                }
            }

            _gameStart            = DateTime.Now;
            _lastGameTimeAnnounce = DateTime.Now;
            ResetArena();
            CountScore();
        }
Example #3
0
        private void CountScore()
        {
            SplatoonArena arena = ActiveArena as SplatoonArena;

            _totalPaintSpots = 0;
            _redScore        = 0;
            _blueScore       = 0;

            for (int x = (int)arena.ArenaTopLeft.X / 16; x <= (int)arena.ArenaBottomRight.X / 16; x++)
            {
                for (int y = (int)arena.ArenaTopLeft.Y / 16; y <= (int)arena.ArenaBottomRight.Y / 16; y++)
                {
                    var tile = Terraria.Main.tile[x, y];
                    if (tile.type > 0)
                    {
                        _totalPaintSpots++;
                    }
                    if (tile.wall > 0)
                    {
                        _totalPaintSpots++;
                    }

                    if (tile.color() == _deepRedPaintID)
                    {
                        _redScore++;
                    }
                    if (tile.wallColor() == _deepRedPaintID)
                    {
                        _redScore++;
                    }
                    if (tile.color() == _deepBluePaintID)
                    {
                        _blueScore++;
                    }
                    if (tile.wallColor() == _deepBluePaintID)
                    {
                        _blueScore++;
                    }
                }
            }
        }