Example #1
0
    void OnMouseDown()
    {
        if (inRange.activeSelf == true)
        {
            Object.Destroy(this.gameObject, 0.0f);
            pickedUp.SetActive(true);

            fadeScript.ResetTime("pickUp");

            FindObjectOfType <AudioManager>().Play("CarDoor");
        }
    }
Example #2
0
    void OnTriggerEnter(Collider collider)
    {
        if (redLights.activeSelf == true)
        {
            fadeScript.ResetTime("ranRed");

            FindObjectOfType <AudioManager>().Play("Beepbeep");
        }
    }
Example #3
0
    void OnMouseDown()
    {
        if (pickedUp.activeSelf == true && inRange.activeSelf == true)
        {
            if (type.text == "1")
            {
                Passenger = Passenger1;
            }
            if (type.text == "2")
            {
                Passenger = Passenger2;
            }
            if (type.text == "3")
            {
                Passenger = Passenger3;
            }

            Vector3 heightOffset = new Vector3(0, 2, 0);
            thePosition  = transform.TransformPoint(Vector3.right * 2);
            thePosition += heightOffset;
            clone        = Instantiate(Passenger, thePosition, this.transform.rotation);
            var cloneBody = clone.GetComponent <Rigidbody>();
            cloneBody.velocity = transform.TransformDirection(Vector3.right * 10);
            clone.transform.Rotate(0.0f, transform.rotation.y + 90.0f, 0.0f, 0.0f);

            if (pickedUp.activeSelf == true)
            {
                pickedUp.SetActive(false);
            }
            if (jobStarted.activeSelf == true)
            {
                jobStarted.SetActive(false);
            }
            if (droppedOff.activeSelf == false)
            {
                droppedOff.SetActive(true);
            }

            Object.Destroy(clone, 5.0f);

            fadeScript.ResetTime("dropOff");

            FindObjectOfType <AudioManager>().Play("CarDoor");
        }
    }