Пример #1
0
    // Spawn a new player, ready for first launch and reset camera position
    public void SpawnPlayer()
    {
        player = Instantiate(playerPrefab, transform.position, Quaternion.identity) as GameObject;
        player.transform.SetParent(transform);
        // Tell other game objects about new player
        swipeController.SetNewPlayer(GetPlayer());
        swipeController.SetFirstLaunch();
        cameraHandle.SetPlayer(GetPlayer());
        platformController.SetPlayer(GetPlayer());
        score.SetPlayer(GetPlayer());
        score.ResetScore();

        // Only need to reset the camera for respawns, not on initial spawn
        if (firstSpawn)
        {
            firstSpawn = false;
        } else
        {
            cameraHandle.ResetCamera();
        }
    }