示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        _currentMoveTime  = 0f;
        _currentPauseTime = 0f;
        var mainManager = GameObject.FindWithTag("MainManager");

        _jgm = mainManager.GetComponent <JumperGameManager>();
    }
示例#2
0
    void Start()
    {
        Instance = this;

        //if (playerPrefab == null)
        if (playerManagerPrefab == null)
        {
            Debug.LogError("<Color=Red><a>Missing</a></Color> playerPrefab Reference. Please set it up in GameObject 'Game Manager'", this);
        }
        else
        {
            if (JumperPlayerManager.LocalPlayerInstance == null)
            {
                /*
                 * Debug.Log("We are Instantiating LocalPlayer from " + Application.loadedLevelName);
                 * // we're in a room. spawn a character for the local player. it gets synced by using PhotonNetwork.Instantiate
                 *
                 * PhotonNetwork.InstantiateInRoomOnly = false;
                 *
                 * PhotonNetwork.Instantiate(this.playerPrefab.name, new Vector3(0f, 5f, 0f), Quaternion.identity, 0);
                 */
                PhotonNetwork.InstantiateInRoomOnly = false;    // Doesn't seem to work

                GameObject playerManager = PhotonNetwork.Instantiate(this.playerManagerPrefab.name, new Vector3(0f, 0f, 0f), Quaternion.identity, 0);
                if (!playerManager)
                {
                    Debug.LogError("Failed to spawn playerManagerPrefab; Spawning now. Network connected status: " + PhotonNetwork.connected);
                    playerManager = Instantiate(playerManagerPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity);
                }
                playerManager.transform.parent = this.transform;
            }
            else
            {
                //Debug.Log("Ignoring scene load for " + Application.loadedLevelName);
            }
        }
    }
示例#3
0
    // Start is called before the first frame update
    void Start()
    {
        var mainManager = GameObject.FindWithTag("MainManager");

        _jgm = mainManager.GetComponent <JumperGameManager>();
    }