Beispiel #1
0
    //This is where we perform the actual action based on
    // the given tag
    void performAction(string tag)
    {
        Gu gu = Gu.Instance;

        switch (tag)
        {
        case "Large Object":
            gu.StartPush();
            break;

        case "Small Object":
            if (gu.IsCarrying())
            {
                print("butts");
                gu.PutDown();
            }
            else
            {
                print("dicks");
                gu.PickUp();
            }
            break;

        default:
            break;
        }
    }
Beispiel #2
0
 // Update is called once per frame
 void Update()
 {
     //when we throw an object we first want to put it down
     //then proceed to add the correct velocity to it and
     //throw it
     if (gu.IsCarrying() && Input.GetButtonDown("Action"))
     {
         GameObject objectToThrow = gu.holdingObject;
         gu.PutDown();
         objectToThrow.transform.rigidbody.AddForce((transform.forward + transform.up) * throwModifier);
     }
 }
Beispiel #3
0
    // Update handles the interaction button being pressed
    // and checks what state Gu is in
    void Update()
    {
        Gu gu = Gu.Instance;

        if (Input.GetButtonDown("Interact"))
        {
            if (gu.IsCarrying())
            {
                performAction(gu.holdingObject.tag);
            }
            else if (gu.validObjectFound())
            {
                performAction(gu.targetObject.tag);
            }
        }
        else if (Input.GetButtonUp("Interact"))
        {
            if (gu.targetObject != null)
            {
                endConcurrentAction(gu.targetObject.tag);
            }
        }
    }