Exemplo n.º 1
0
    override public void Start()
    {
        float spreadX = 125;
        //float startY = -TeamCol.HEIGHT/2-200;

        float colY = -20.0f;

        TeamCol col = new TeamCol(PlayerManager.Team_None);

        cols.Add(col);
        AddChild(col);
        col.y = colY;

        col   = new TeamCol(PlayerManager.Team_Wolves);
        col.x = -spreadX;
        cols.Add(col);
        AddChild(col);
        col.y = colY;

        col   = new TeamCol(PlayerManager.Team_Villagers);
        col.x = spreadX;
        cols.Add(col);
        AddChild(col);
        col.y = colY;

        rowHolder   = new FContainer();
        rowHolder.y = colY;
        AddChild(rowHolder);

        foreach (var player in Core.playerManager.players)
        {
            HandleOnPlayerAdded(player);
        }



        Core.playerManager.OnPlayerAdded   += HandleOnPlayerAdded;
        Core.playerManager.OnPlayerRemoved += HandleOnPlayerRemoved;

        if (Config.SHOULD_AUTO_SELECT_TEAMS || Config.SHOULD_SKIP_PLAYER_SELECT)
        {
            for (int r = 0; r < rows.Count; r++)
            {
                rows[r].player.team = r % 2 == 0 ? PlayerManager.Team_Wolves : PlayerManager.Team_Villagers;
            }
        }

        for (int r = 0; r < rows.Count; r++)
        {
            rows[r].player.team = PlayerManager.Team_None;
            rows[r].inner.x     = GetColForTeam(rows[r].player.team).x;
        }

        CheckStatus();

        if (Config.SHOULD_SKIP_PLAYER_SELECT)
        {
            StartGame();
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        bool didTeamChange       = false;
        bool didPlayerPressStart = false;

        foreach (var row in rows)
        {
            var  player  = row.player;
            Team newTeam = null;

            if (player.team.teamToTheLeft != null && player.device.LeftStick.Left.WasPressed)
            {
                newTeam = player.team.teamToTheLeft;
            }
            else if (player.team.teamToTheRight != null && player.device.LeftStick.Right.WasPressed)
            {
                newTeam = player.team.teamToTheRight;
            }

            if (newTeam != null)
            {
                player.team = newTeam;
                TeamCol col = GetColForTeam(newTeam);
                Go.killAllTweensWithTarget(row.inner);
                Go.to(row.inner, 0.3f, new TweenConfig().x(col.x).expoOut());
                didTeamChange = true;

                if (newTeam == PlayerManager.Team_Villagers)
                {
                    FXPlayer.VillAttack();
                }
                else if (newTeam == PlayerManager.Team_Wolves)
                {
                    FXPlayer.WolfAttack();
                }
            }

            if (player.device.MenuWasPressed)
            {
                didPlayerPressStart = true;
            }
        }

        if (didTeamChange)
        {
            CheckStatus();
        }

        if (isReady && didPlayerPressStart)
        {
            StartGame();
        }
    }
Exemplo n.º 3
0
    public override void Start()
    {
        float spreadX = 125;
        //float startY = -TeamCol.HEIGHT/2-200;

        float colY = -20.0f;

        TeamCol col = new TeamCol(PlayerManager.Team_None);
        cols.Add(col);
        AddChild(col);
        col.y = colY;

        col = new TeamCol(PlayerManager.Team_Wolves);
        col.x = -spreadX;
        cols.Add(col);
        AddChild(col);
        col.y = colY;

        col = new TeamCol(PlayerManager.Team_Villagers);
        col.x = spreadX;
        cols.Add(col);
        AddChild(col);
        col.y = colY;

        rowHolder = new FContainer();
        rowHolder.y = colY;
        AddChild(rowHolder);

        foreach(var player in Core.playerManager.players)
        {
            HandleOnPlayerAdded(player);
        }

        Core.playerManager.OnPlayerAdded += HandleOnPlayerAdded;
        Core.playerManager.OnPlayerRemoved += HandleOnPlayerRemoved;

        if(Config.SHOULD_AUTO_SELECT_TEAMS || Config.SHOULD_SKIP_PLAYER_SELECT)
        {
            for(int r = 0; r<rows.Count;r++)
            {
                rows[r].player.team = r % 2 == 0 ? PlayerManager.Team_Wolves : PlayerManager.Team_Villagers;
            }
        }

        for(int r = 0; r<rows.Count;r++)
        {
            rows[r].player.team = PlayerManager.Team_None;
            rows[r].inner.x = GetColForTeam(rows[r].player.team).x;
        }

        CheckStatus();

        if(Config.SHOULD_SKIP_PLAYER_SELECT)
        {
            StartGame();
        }
    }