Pickup() public method

public Pickup ( ) : bool
return bool
Beispiel #1
0
    public virtual ObjectInteraction Pickup(ObjectInteraction objPicked, PlayerInventory pInv)
    {    //completes the pickup.
        //FIELD PICKUP objPicked.PickedUp=true;
        if (objPicked.GetComponent <Container>() != null)
        {
            Container.SetPickedUpFlag(objPicked.GetComponent <Container>(), true);
            Container.SetItemsParent(objPicked.GetComponent <Container>(), GameWorldController.instance.InventoryMarker.transform);
            Container.SetItemsPosition(objPicked.GetComponent <Container>(), GameWorldController.instance.InventoryMarker.transform.position);
        }
        //UWHUD.instance.CursorIcon=objPicked.GetInventoryDisplay().texture;
        pInv.ObjectInHand = objPicked;
        if (objPicked.GetComponent <Rigidbody>() != null)
        {
            FreezeMovement(objPicked.gameObject);
        }

        objPicked.transform.position = GameWorldController.instance.InventoryMarker.transform.position;
        objPicked.transform.parent   = GameWorldController.instance.InventoryMarker.transform;
        GameWorldController.MoveToInventory(objPicked);
        pInv.ObjectInHand = objPicked;
        objPicked.Pickup();
        if (WindowDetectUW.ContextUIEnabled)
        {
            if (MouseLookEnabled)
            {
                WindowDetectUW.SwitchFromMouseLook();
            }
        }
        return(objPicked);
    }
Beispiel #2
0
    public virtual void Pickup(ObjectInteraction objPicked, PlayerInventory pInv)
    {    //completes the pickup.
        objPicked.PickedUp = true;
        if (objPicked.GetComponent <Container>() != null)
        {
            Container.SetPickedUpFlag(objPicked.GetComponent <Container>(), true);
            Container.SetItemsParent(objPicked.GetComponent <Container>(), InvMarker.transform);
            Container.SetItemsPosition(objPicked.GetComponent <Container>(), InvMarker.transform.position);
        }
        CursorIcon        = objPicked.GetInventoryDisplay().texture;
        pInv.ObjectInHand = objPicked.transform.name;
        //////pInv.JustPickedup=true;//To stop me throwing it away immediately.
        if (objPicked.GetComponent <Rigidbody>() != null)
        {
            WindowDetect.FreezeMovement(objPicked.gameObject);
        }
        objPicked.transform.position = InvMarker.transform.position;
        objPicked.transform.parent   = InvMarker.transform;

        objPicked.Pickup();        //Call pickup event for this object.
    }
Beispiel #3
0
    public virtual ObjectInteraction Pickup(ObjectInteraction objPicked, PlayerInventory pInv)
    {    //completes the pickup.
        objPicked.PickedUp = true;
        if (objPicked.GetComponent <Container>() != null)
        {
            Container.SetPickedUpFlag(objPicked.GetComponent <Container>(), true);
            Container.SetItemsParent(objPicked.GetComponent <Container>(), GameWorldController.instance.InventoryMarker.transform);
            Container.SetItemsPosition(objPicked.GetComponent <Container>(), GameWorldController.instance.InventoryMarker.transform.position);
        }
        UWHUD.instance.CursorIcon = objPicked.GetInventoryDisplay().texture;
        pInv.ObjectInHand         = objPicked.transform.name;
        if (objPicked.GetComponent <Rigidbody>() != null)
        {
            GameWorldController.FreezeMovement(objPicked.gameObject);
        }

        objPicked.transform.position = GameWorldController.instance.InventoryMarker.transform.position;
        objPicked.transform.parent   = GameWorldController.instance.InventoryMarker.transform;
        GameWorldController.MoveToInventory(objPicked);
        pInv.ObjectInHand = objPicked.transform.name;
        objPicked.Pickup();
        return(objPicked);
    }
Beispiel #4
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space) && currentInterObj == true)
     {
         if (currentInterObjScrpit.info == true)
         {
             currentInterObjScrpit.Info();
         }
     }
     if (Input.GetKeyDown(KeyCode.Space) && currentInterObj == true)
     {
         if (currentInterObjScrpit.pickup == true)
         {
             currentInterObjScrpit.Pickup();
         }
     }
     if (Input.GetKeyDown(KeyCode.Space) && currentInterObj == true)
     {
         if (currentInterObjScrpit.talks == true)
         {
             currentInterObjScrpit.Talks();
         }
     }
 }
    public virtual ObjectInteraction Pickup(ObjectInteraction objPicked, PlayerInventory  pInv)
    {
        //completes the pickup.

        objPicked.PickedUp=true;
        if (objPicked.GetComponent<Container>()!=null)
        {
            Container.SetPickedUpFlag(objPicked.GetComponent<Container>(),true);
            Container.SetItemsParent(objPicked.GetComponent<Container>(),InvMarker.transform);
            Container.SetItemsPosition (objPicked.GetComponent<Container>(),InvMarker.transform.position);
        }
        UWHUD.instance.CursorIcon=objPicked.GetInventoryDisplay().texture;
        pInv.ObjectInHand=objPicked.transform.name;
        //////pInv.JustPickedup=true;//To stop me throwing it away immediately.
        if (objPicked.GetComponent<Rigidbody>() !=null)
        {
            GameWorldController.FreezeMovement(objPicked.gameObject);
        }
        //Clone the object into the inventory
                if (WindowDetectUW.UsingRoomManager==true)
                {
                        GameObject objClone = Instantiate(objPicked.gameObject);
                        objClone.name=objPicked.name;
                        objPicked.name=objPicked.name+ "_destroyed";
                        //objPicked.transform.DestroyChildren();
                        DestroyImmediate(objPicked.gameObject);

                        objClone.transform.position = InvMarker.transform.position;
                        objClone.transform.parent=InvMarker.transform;
                        objClone.GetComponent<ObjectInteraction>().Pickup();
                        /*
                        UniqueIdentifier uid=objClone.GetComponent<UniqueIdentifier>();
                        if (uid!=null)
                        {
                                //uid.Id=uid.GetInstanceID().ToString();
                        }
                        */
                        objClone.GetComponent<ObjectInteraction>().Pickup();
                        return objClone.GetComponent<ObjectInteraction>();
                }
                else
                {
                        objPicked.transform.position=InvMarker.transform.position;
                        objPicked.transform.parent=InvMarker.transform;
                        objPicked.Pickup();
                        return objPicked;
                }

        //objPicked.transform.position = InvMarker.transform.position;
        //objPicked.transform.parent=InvMarker.transform;

        //objPicked.Pickup();//Call pickup event for this object.
    }