Ejemplo n.º 1
0
    void GetPlayerInput()
    {
        if (Input.GetButtonDown("Jump"))
        {
            OnJump?.Invoke();
        }
        //TextPromptA.text = "A - " + (OnJump.GetInvocationList().Length > 0 ?
        //                                 OnJump.GetInvocationList().Length.Method.Name :
        //                                 "...");
        if (Input.GetButtonDown("Broom"))
        {
            OnBroom?.Invoke();
        }
        if (Input.GetButtonUp("Jump"))
        {
            OnJumpRelease?.Invoke();
        }
        if (Input.GetButtonDown("Interact"))
        {
            OnInteract?.Invoke();
        }
        if (Input.GetButtonDown("Attack"))
        {
            OnAttack?.Invoke();
        }
        if (Input.GetButtonUp("Attack"))
        {
            OnAttackRelease?.Invoke();
        }
        if (Input.GetButtonDown("Magic"))
        {
            OnMagic?.Invoke();
        }

        if (Input.GetAxisRaw("CameraChangeVertical") > camSwitchThreshold)
        {
            ChangeCameraState(CamState.Follow);
        }
        if (Input.GetAxisRaw("CameraChangeHorizontal") < -camSwitchThreshold)
        {
            ChangeCameraState(CamState.Free);
        }
        if (Input.GetAxisRaw("CameraChangeHorizontal") > camSwitchThreshold)
        {
            ChangeCameraState(CamState.Nodes);
        }
        if (Input.GetAxisRaw("CameraChangeVertical") < -camSwitchThreshold)
        {
            ChangeCameraState(CamState.FirstPerson);
        }
        if (Input.GetButtonDown("CameraCenter"))
        {
            ChangeCameraState(CamState.Target);
        }
        if (Input.GetButtonUp("CameraCenter"))
        {
            ChangeCameraState(lastCameraStateInput);
        }

//        print(Input.GetAxis("CameraChangeHorizontal"));

        var movementValue = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));

        OnMove?.Invoke(movementValue.magnitude > MovementDeadZone ? movementValue.normalized : Vector2.zero);
    }
Ejemplo n.º 2
0
 public void Magic(int i)
 {
     OnMagic?.Invoke(this, i);
 }