コード例 #1
0
ファイル: GameManager.cs プロジェクト: ProgHaj/LArena
    void ResetGame()
    {
        GameObject ground = GameObject.FindWithTag("Ground");

        if (ground != null)
        {
            ShrinkOverTime script = ground.GetComponent <ShrinkOverTime>();
            if (script != null)
            {
                script.active = false;
            }

            Transform gTrans = ground.GetComponent <Transform>();
            if (gTrans != null)
            {
                gTrans.localScale = new Vector3(3, 1, 1);
            }
        }

        foreach (GameObject player in playerObjects)
        {
            if (player != null)
            {
                Destroy(player.gameObject);
            }
        }


        playersAlive  = 0;
        playerObjects = new List <GameObject>();
    }
コード例 #2
0
ファイル: GameManager.cs プロジェクト: ProgHaj/LArena
    void SpawnPlayers()
    {
        for (int i = 0; i < players; i++)
        {
            GameObject player       = Instantiate(playerPrefab, transform.position, transform.rotation);
            Player     playerScript = player.GetComponent <Player>();
            playerScript.PlayerId = i;
            playerScript.Color    = colors[i];
            playerObjects.Add(player);
        }

        GameObject ground = GameObject.FindWithTag("Ground");

        if (ground != null)
        {
            ShrinkOverTime script = ground.GetComponent <ShrinkOverTime>();
            if (script != null)
            {
                script.active = true;
            }
        }

        isSpawningPlayers = false;
        isPlayingGame     = true;
    }