예제 #1
0
    void OnLevelWasLoaded(int level)
    {
        Debug.Log("Starting in: " + Application.loadedLevelName);

        if (Application.loadedLevelName == menuScene)
        {
            menu = FindObjectOfType <Menu>();
            hud  = null;

            ModeManager.ModeData mode = ModeManager.GetCurrentMode();

            if (mode != null)
            {
                Component component = gameObject.GetComponent(mode.mode);

                if (component)
                {
                    Destroy(component);
                }
            }
        }
        else
        {
            hud = FindObjectOfType <HUD>();
            gameObject.AddComponent(ModeManager.GetCurrentMode().mode);

            menu = null;
        }
    }
예제 #2
0
    void OnServerUpdate()
    {
        Lobby lobby = Lobby.instance;

        bool trackSelected = false;

        TrackManager.TrackData trackData = TrackManager.GetCurrentTrack();

        if (trackData != null)
        {
            trackText.text    = trackData.name;
            trackImage.sprite = trackData.image;
            trackSelected     = true;
        }
        else
        {
            Debug.Log("Invalid track: [" + Lobby.instance.track + "]");
        }

        bool modeSelected = false;

        ModeManager.ModeData modeData = ModeManager.GetCurrentMode();

        if (modeData != null)
        {
            modeText.text    = modeData.name;
            modeImage.sprite = modeData.image;
            modeSelected     = true;
        }
        else
        {
            Debug.Log("Invalid mode: [" + Lobby.instance.mode + "]");
        }

        if (trackSelected && modeSelected && lobby.GetMyProfile().selectedCar != null)
        {
            lobby.UpdateProfile(Network.player, PlayerProfile.READY, bool.TrueString);
        }

        ReadyChecks();
    }