Пример #1
0
    private bool placed = false; // Records whether the object has been placed or not

    public override void OnTriggerWasPressed(InteractionController controller)
    {
        if (!placed)
        {
            base.OnTriggerWasPressed(controller);
        }
        else
        {
            controller.GetComponent <ControllerUI>().ToggleCanvas();
            if (controller.GetComponentInChildren <Canvas>())
            {
                controller.GetComponentInChildren <Text>().text = description;
            }
        }
    }
Пример #2
0
    private void HandleCarriedObject()
    {
        if (objectInHand != null)
        {
            Vector3 targetPosition     = cameraTransform.position + cameraTransform.forward * actualCarryDistance;
            Vector3 distanceFromPlayer = cameraTransform.position - objectInHand.transform.position;

            objectInHand.GetComponent <Rigidbody>().MovePosition(Vector3.Lerp(objectInHand.transform.position, targetPosition, 0.1f));

            if (distanceFromPlayer.magnitude > 8f) // || objectInHand.straining)
            {
                objectInHand.OnDrop();
                objectInHand = null;
            }
        }
    }
Пример #3
0
    public sealed override void Use(InteractionController im)
    {
        base.Use(im);

        ItemManager itemManager = im.GetComponent <ItemManager>();

        if (itemManager)
        {
            itemManager.Take(this);
        }
        else
        {
            Debug.LogWarning("Item manager is missing");
        }

        Debug.Log("Took: " + name);

        OnTake();
    }
Пример #4
0
 void Start()
 {
     init();
     interactionController = (InteractionController)interactionController.GetComponent(typeof(InteractionController));
     print("grasp" + interactionController.Grasp);
 }