Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            SetDemonstration(0);
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            SetDemonstration(1);
        }

        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            SetDemonstration(2);
        }

        //Set new target for spotlight
        if (spotlight.ReachedTarget())
        {
            spotlight.SetTarget(new Vector3(Random.Range(-10, 10), spotlight.transform.position.y, spotlight.transform.position.z));
            spotlight.SetSpeed(Random.Range(0.1f, 0.9f));
        }

        //Check if the player is in the spotlight if not drop approval.
        if (spotlight.InSpotLight(GameObject.Find("Dan").transform.position))
        {
            powerBar.ChangeBar(0.001f);
        }
        else
        {
            powerBar.ChangeBar(0);
        }

        cooldown -= 0.01f;

        if (cooldown < 0)
        {
            t.text = "";
        }

        if (powerBar.GetFillamount() == 1)
        {
            instructions.text = "PRESS 4";
        }
        else
        {
            instructions.text = "";
        }
    }