ObjectInteraction.Use C# (CSharp) Method

Use() public method

public Use ( ) : bool
return bool
    public bool Use()
    {
        //Code to activate objects by type.
                //Objects will return true if they have done everything that needs to be done and false if they expect the calling code to do something instead.
                GameObject ObjectInHand =null;
                object_base item=null;//Base object class

                ObjectInHand=GameWorldController.instance.playerUW.playerInventory.GetGameObjectInHand();
                if (ObjectInHand != null)
                {
                    //First do a combineobject test. This will implement object combinatiosn defined by UW1/2
                    GameObject combined = CombineObject(this.gameObject,ObjectInHand);
                    if (combined!=null)
                    {
                        GameWorldController.instance.playerUW.playerInventory.ObjectInHand = combined.name	;
                        return true;
                    }
                }

                item = this.GetComponent<object_base>();
                if (item!=null)
                {
                        return item.use ();
                }
                else
                {
                        return false;
                }
    }

Usage Example

 public void HandleUseDown()
 {
     if (interaction != null)
     {
         interaction.Use();
     }
     HideMenu();
 }
All Usage Examples Of ObjectInteraction::Use