Esempio n. 1
0
    //public void HandlePickUpSpawnObject()
    //{
    //    //if inventory is not full and there is a picked up object
    //    if (!IsInventoryFull())
    //    {
    //        //if facing ingredient shelf
    //        if (playerRadar.facingShelf && canSpawnIngredient)
    //        {
    //            Debug.Log("Facing shelf, spawn ingredient");
    //            playerPickUppable.SpawnIngredient();
    //            canDropObject = true;
    //        }

    //        //if facing pickuppable
    //        else if (playerRadar.facingPickuppable)
    //        {
    //            if (canPickUpObject)
    //            {
    //                //if it belongs to layer 12
    //                if(playerRadar.detectedObject && playerRadar.detectedObject.layer == 12)
    //                {
    //                    return;
    //                }
    //                else
    //                {
    //                    playerPickUppable.PickUpObject(); //pick up object
    //                    canDropObject = true; //object can now be dropped
    //                }
    //            }
    //        }
    //    }
    //    else
    //    {
    //        Debug.LogWarning("PlayerRadar: Unable to pick up");
    //    }
    //}

    //attached to button
    //if object can be dropped, then call the function

    public void HandleDropObject()
    {
        if (canDropObject && !canPickUpObject)
        {
            playerPickUppable.DropObject();
            Debug.Log("PlayerObject: Dropped an object");
            canDropObject = false;
        }
        else
        {
            Debug.LogWarning("PlayerRadar: Nothing to drop");
        }
    }