Wand.use C# (CSharp) Method

use() public method

public use ( ) : bool
return bool
    public override bool use()
    {
        if (GameWorldController.instance.playerUW.playerInventory.ObjectInHand=="")
        {
            if (SpellObjectQuantity >0)
                {
                    GameWorldController.instance.playerUW.PlayerMagic.CastEnchantment(GameWorldController.instance.playerUW.gameObject,null,GetActualSpellIndex(),Magic.SpellRule_TargetSelf );
                    if (objInt().isEnchanted==false)
                        {
                        SpellObjectQuantity--;
                        if (SpellObjectQuantity ==0)
                        {
                            objInt().item_id = objInt().item_id+4;//Become a broken wand.
                            objInt().InvDisplayIndex=objInt().InvDisplayIndex+4;
                            objInt().WorldDisplayIndex=objInt().WorldDisplayIndex+4;
                            objInt().RefreshAnim();
                        }
                    }
                }
            return true;
        }
        else
        {
            return ActivateByObject(GameWorldController.instance.playerUW.playerInventory.GetGameObjectInHand());
        }
    }