Exemplo n.º 1
0
    void drop()
    {
        MoveHands hand_script = this_player.GetComponent(typeof(MoveHands)) as MoveHands; //get the script for the current player grabbing

        hand_script.SetDefaultHands();

        isHolding = false;                                  //the player is no longer holding the thing

        this.transform.parent = null;                       //DE-parent the object
        this.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None;
        this.GetComponent <Rigidbody>().useGravity  = true; //turn gravity back on so that coffeeObj falls normally

        if (isValidsurface == false)                        //dropping/colliding with non-valid object (spilling and dropping the coffee)

        {
            this_collider.enabled = !this_collider.enabled; //disable the collider so it won't call the drop method again
            cup_spill_src.Play();                           //play the sound of a spill

            //de-parent the children from the cup
            plate_chld.transform.parent = null;
            cup_chld.transform.parent   = null;

            StartCoroutine(SpillCoroutine(cup_chld));

            //create rigidbodies for the cup and plate so they fall
            plate_chld.AddComponent <Rigidbody>();
            cup_chld.AddComponent <Rigidbody>();
        }
        else  //droping on a valid object (won't spill the coffee)
        {
            sound_clink_src.Play();
            this.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePositionX;
            this.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePositionZ;
        }
    }
Exemplo n.º 2
0
 public UCWaitSpinner()
 {
     InitializeComponent();
     MoveHands.RepeatBehavior  = RepeatBehavior.Forever;
     LayoutRoot.Opacity        = 0d;
     DisappearClock.Completed += (object sender, EventArgs e) => { MoveHands.Stop(); };
 }
Exemplo n.º 3
0
    void pickup()
    {
        MoveHands hand_script = this_player.GetComponent(typeof(MoveHands)) as MoveHands; //get the script for the current player grabbing

        hand_script.SetPickupHands();                                                     //set the pickup hands so the player is picking the thing up

        sound_clink_src.Play();
        this.GetComponent <Rigidbody>().useGravity  = false; //turn off the gravity so the coffee won't fall
        this.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;
        this.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePosition;

        this.transform.position = dest.position;  //update dest position!!!
        //this.transform.position = dest;  //update the position!!!

        this.transform.parent = dest.transform; //transform to holdObject
        isHolding             = true;
    }
Exemplo n.º 4
0
 public void Start()
 {
     MoveHands.Stop();
     AppearClock.Begin();
     MoveHands.Begin();
 }