Exemple #1
0
    private void SetPlayerNumber(PLAYERNUM _player)
    {
        bool flg = false;

        //登録済みのコントローラーかを調べる
        foreach (int _number in playerNumber)
        {
            //登録済みの場合は、登録できない
            if (_number == (int)_player)
            {
                flg = true;

                Debug.Log("登録できません");
            }
        }

        if (!flg)
        {
            //コントローラー番号を1Pから割り当てる
            playerNumber[playerCount] = (int)_player;

            Debug.Log((PLAYERNUM)playerCount + " Player 登録完了");

            playerCount++;
        }
    }
Exemple #2
0
 void GameStart(PLAYERNUM _player)
 {
     foreach (int _number in playerNumber)
     {
         if (_number == (int)_player)
         {
             sceneFader.SceneChange("Game");
         }
     }
 }
Exemple #3
0
    /// <summary>
    /// エントリーの処理をしてくれるやつ
    /// </summary>
    /// <param name="_player">エントリーしたいコントローラーの番号</param>
    void AddPlayer(PLAYERNUM _player)
    {
        bool flg          = false;
        int  addPlayerNum = playerNumber.Length;

        foreach (int _number in playerNumber)
        {
            if (_number == (int)_player)
            {
                flg = true;

                Debug.Log("登録できません");
            }
        }

        if (!flg)
        {
            for (int i = playerNumber.Length - 1; i >= 0; i--)
            {
                if (playerNumber[i] == -1)
                {
                    addPlayerNum = i;
                }
            }
            playerNumber[addPlayerNum] = (int)_player;

            Debug.Log((PLAYERNUM)playerCount + " player 登録完了");
            Debug.Log(playerNumber[0] + ":" + playerNumber[1] + ":" + playerNumber[2] + ":" + playerNumber[3]);

            Vector3 instansPos = new Vector3(stage[addPlayerNum].transform.position.x, 1.6f, stage[addPlayerNum].transform.position.z);

            player_Obj[addPlayerNum] = Instantiate(
                playerPre[addPlayerNum],
                instansPos,
                Quaternion.identity);

            player_Obj[addPlayerNum].transform.parent = stage[addPlayerNum].transform;

            playerCam[addPlayerNum].SetActive(true);
            joinIcon[addPlayerNum].sprite = buttonSprite[1];

            playerCount++;
        }
        if (playerCount == 1)
        {
            gameStart_Image.SetActive(true);
        }
        Debug.Log("<color=blue>In</color>" + "playerCount: " + playerCount);
    }
Exemple #4
0
    void RemovePlayer(PLAYERNUM _player)
    {
        for (int i = 0; i < playerNumber.Length; i++)
        {
            if ((int)_player == playerNumber[i])
            {
                playerNumber[i] = -1;
                Destroy(player_Obj[i]);
                playerCam[i].SetActive(false);
                joinIcon[i].sprite = buttonSprite[0];
                playerCount--;
            }
        }
        Debug.Log((PLAYERNUM)playerCount + " player 登録解除");
        Debug.Log(playerNumber[0] + ":" + playerNumber[1] + ":" + playerNumber[2] + ":" + playerNumber[3]);

        if (playerCount == 0)
        {
            gameStart_Image.SetActive(false);
        }
        Debug.Log("<color=red>OUT</color>" + "playerCount: " + playerCount);
    }