예제 #1
0
 public void Awake()
 {
     if (INSTANCE != null)
     {
         throw new InvalidOperationException("MouseInputUtil may only be created once!");
     }
     INSTANCE = this;
 }
예제 #2
0
    // private void OnEnable(){
    //  InputController.GetInputManager().Player.Interact.performed += CheckSwitchPlayer;
    // }

    // private void OnDisable(){
    //  InputController.GetInputManager().Player.Interact.performed -= CheckSwitchPlayer;
    // }

    private void CheckSwitchPlayer(InputAction.CallbackContext ctx)
    {
        MouseInputUtil.RayCastMousePosition(hit =>
        {
            GameObject hitObj = hit.transform.gameObject;
            if (hitObj.GetComponent <FriendController>() != null && hitObj.GetComponent <FriendController>().settings.active)
            {
                SetCurrentPlayer(hitObj);
            }
        });
    }
예제 #3
0
 private void CheckInteraction(InputAction.CallbackContext ctx)
 {
     MouseInputUtil.RayCastMousePosition(hit =>
     {
         Interactable interactable = hit.collider.transform.GetComponent <Interactable>();
         if (interactable == null)
         {
             interactable = hit.collider.transform.GetComponentInParent <Interactable>();
         }
         if (interactable != null)
         {
             Interaction interaction = new Interaction(InteractionType.PLAYER, currentPlayer);
             interactable.Interact(interaction);
         }
     });
 }
예제 #4
0
 void Update()
 {
     if (buildingMode)
     {
         builderGroundController.Preview(builderGroundController.settings.groundLayoutSettings.hex, MouseInputUtil.GetCursorHoverOver().point);
     }
 }