示例#1
0
    [SerializeField] private AudioClip menuMusic;                      // The clip to play when the bar finishes filling.


    // Use this for initialization
    void Start()
    {
        musicAudio.clip = menuMusic;
        musicAudio.loop = true;
        musicAudio.Play();
        GameObject mc = GameObject.Find("Motorcycle");               // get mc gameobject

        modelControllerScript = mc.GetComponent <modelController>(); // mc script
        modelControllerScript.setSpotlight(daylight);

        raceMap     = GameObject.Find("raceTrackLakeLevel");
        speedwayMap = GameObject.Find("DG MotorSpeedWay");

        initMap();
    }
示例#2
0
    [SerializeField] private AudioClip menuMusic;                      // The clip to play when the bar finishes filling.


    // Use this for initialization
    void Start()
    {
        musicAudio.clip = menuMusic;
        musicAudio.loop = true;
        musicAudio.Play();
        GameObject mc = GameObject.Find("Motorcycle");               // get mc gameobject

        modelControllerScript = mc.GetComponent <modelController>(); // mc script
        modelControllerScript.setSpotlight(daylight);

        raceMap     = GameObject.Find("raceTrackLakeLevel");
        speedwayMap = GameObject.Find("DG MotorSpeedWay");

        initMap();
        if (PlayerPrefs.GetFloat("Score") == 0)                   // first play
        {
            PlayerPrefs.SetFloat("Score", (float)Mathf.Infinity); // reset best score
        }
        if (PlayerPrefs.GetString("Name") == "")                  // first player
        {
            PlayerPrefs.SetString("Name", "Unknown Player");
        }
    }
示例#3
0
    //toggle sun intensity
    public void toggleLightning()
    {
        GameObject sun        = GameObject.Find("Sun");
        GameObject buttonText = GameObject.Find("nightModeText");

        nightModeText = buttonText.GetComponent <UnityEngine.UI.Text> ();

        float intensity = daylightIntensity;

        if (daylight)
        {
            intensity          = nightIntensity;
            daylight           = false;
            nightModeText.text = "Daylight";
        }
        else
        {
            daylight           = true;
            nightModeText.text = "Night Mode";
        }
        sun.GetComponent <UnityEngine.Light> ().intensity = intensity;
        modelControllerScript.setSpotlight(daylight);
    }