예제 #1
0
    public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId)
    {
        Debug.Log("ON SERVER ADD PLAYER CALLED");
        //GameObject go = Instantiate (PlayerObject, Vector3.zero, Quaternion.identity) as GameObject;
        GameObject        player = (GameObject)Instantiate(playerPrefab, new Vector3(0, 20f, 0), Quaternion.identity);
        LocalPlayerSender hisLCP = player.GetComponent <LocalPlayerSender> ();

        hisLCP.PlayerID = playerIds++;
        //hisLCP.myPlayerOnTheServer = go.GetComponent<LocalPlayerController> ();
        //go.SetActive (false);
        NetworkServer.AddPlayerForConnection(conn, player, playerControllerId);
        serverGameManager.addLCP(hisLCP);
    }
예제 #2
0
    IEnumerator MultiSpawnPlayerAfter(Vector3 SpawnPosition, int playerI, LocalPlayerSender LPS)
    {
        GameObject pie = Instantiate(PhaseInEffect, UtilityScript.transformToCartesian(SpawnPosition), Quaternion.identity) as GameObject;

        pie.transform.SetParent(GameManager.GMInstance.root.transform);
        yield return(new WaitForSeconds(PhaseInDelay));

        SoundManager.play_spawn();
        GameObject localPlayer = MonoBehaviour.Instantiate(localPlayerPrefabs [(playerI % (localPlayerPrefabs.Length))], SpawnPosition, new Quaternion()) as GameObject;

        localPlayer.transform.SetParent(GameManager.GMInstance.root.transform);
        LivingPlayers.Add(localPlayer);
        //SpriteRenderer PlayerSR = localPlayer.GetComponentInChildren<SpriteRenderer> ();
        //Debug.Log ("GETTING COLOR AT INDEX " + playerI);
        //PlayerSR.color = playerColors[(playerI % (playerColors.Count))];
        LocalPlayerController LCP = localPlayer.GetComponent <LocalPlayerController> ();

        LCP.PlayerName          = playerNames [playerI % playerNames.Length];
        LPS.myPlayerOnTheServer = LCP;
        LCP.playerIndex         = playerI;

        //playerTexts [playerI].text = LCP.PlayerName + ": " + teamScores [playerI];
        //playerTexts [playerI].enabled = true;

        cameraLoc.updatePlayers = true;

        if (usePowerUps)
        {
            PUS.spawnPowerups = true;
        }

        if (useEnvironmentEffects)
        {
            EM.enableEnvironmentEffects = true;
        }
    }
예제 #3
0
    // Use this for initialization

    void SetupInputHandler()
    {
        LPC = GetComponent <LocalPlayerSender> () as LocalPlayerSender;
    }
예제 #4
0
 /// <summary>
 /// Starts the game. Initializes rings, players, sounds, ...
 /// </summary>
 public void addLCP(LocalPlayerSender LPS)
 {
     LocalPlayerSenders.Add(LPS);
 }