コード例 #1
0
 public override void PlayerInRangeUpdate(InteractableController interactable)
 {
     if (interactable.displayImage != null)
     {
         interactable.ToggleImage(false);
     }
     interactable.TransitionToState(interactable.idleState);
 }
コード例 #2
0
 public override void EnterState(InteractableController interactable)
 {
     interactable.outlineObject.SetActive(true);
     if (interactable.displayImage != null)
     {
         interactable.ToggleImage(true);
         interactable.ChangeSprite();
     }
 }
コード例 #3
0
    public override void Update(InteractableController interactable)
    {
        RaycastHit hit;
        int        layerMask = 1 << 10;
        bool       mouseOver = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 50, layerMask, QueryTriggerInteraction.Ignore);

        if (!mouseOver)
        {
            if (interactable.displayImage != null)
            {
                interactable.ToggleImage(false);
                interactable.TransitionToState(interactable.playerCloseState);
            }
        }
        else
        {
            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                interactable.ToggleSwitchState();
            }
        }
    }