예제 #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
파일: Item.cs 프로젝트: nothke/LD39-Power
    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);
 }