public void Awake()
    {
        m_Controls = new SimpleControls();

        m_Controls.gameplay.fire.performed +=
            ctx =>
        {
            if (ctx.interaction is SlowTapInteraction)
            {
                StartCoroutine(BurstFire((int)(ctx.duration * burstSpeed)));
            }
            else
            {
                Fire();
            }
            m_Charging = false;
        };
        m_Controls.gameplay.fire.started +=
            ctx =>
        {
            if (ctx.interaction is SlowTapInteraction)
            {
                m_Charging = true;
            }
        };
        m_Controls.gameplay.fire.canceled +=
            ctx =>
        {
            m_Charging = false;
        };
    }
 private void Awake()
 {
     AudioSource = gameObject.AddComponent <AudioSource>() as AudioSource;
     Controls    = new SimpleControls();
     Events      = new EventsDefault();
     UnityAwake();
 }
Exemple #3
0
    // Start is called before the first frame update
    void Awake()
    {
        _simpleControls = new SimpleControls();
        _simpleControls.gameplay.SetCallbacks(this);
        _simpleControls.gameplay.Enable();

        _yaw   = transform.rotation.eulerAngles.y;
        _pitch = pitchControllerTransform.localRotation.eulerAngles.x;
        _characterController = GetComponent <CharacterController>();
        Cursor.lockState     = CursorLockMode.Locked;
        Cursor.visible       = false;
        GameController.GetInstance().PlayerController = this;
        _itemsArray = new Item[inventoryUI.transform.childCount - 1];
    }
    public void Awake()
    {
        controls = new SimpleControls();
        controls.gameplay.move.performed += ctx => m_Move = ctx.ReadValue <Vector2>();
        controls.gameplay.look.performed += ctx => m_Look = ctx.ReadValue <Vector2>();
        controls.gameplay.move.canceled  += ctx => m_Move = Vector2.zero;
        controls.gameplay.look.canceled  += ctx => m_Look = Vector2.zero;

        controls.gameplay.fire.performed +=
            ctx =>
        {
            if (ctx.interaction is SlowTapInteraction)
            {
                StartCoroutine(BurstFire((int)(ctx.duration * burstSpeed)));
            }
            else
            {
                Fire();
            }
            m_Charging = false;
        };
        controls.gameplay.fire.started +=
            ctx =>
        {
            if (ctx.interaction is SlowTapInteraction)
            {
                m_Charging = true;
            }
        };
        controls.gameplay.fire.canceled +=
            ctx =>
        {
            m_Charging = false;
        };
        controls.gameplay.jump.performed += ctx =>
        {
            var jump = new Vector3(0.0f, jumpForce, 0.0f);
            if (isGrounded)
            {
                m_Rigidbody.AddForce(jump * jumpForce, ForceMode.Impulse);
                isGrounded = false;
            }
        };
    }
Exemple #5
0
 public GameplayActions(SimpleControls wrapper)
 {
     m_Wrapper = wrapper;
 }
Exemple #6
0
 private void Awake()
 {
     controls = new SimpleControls();
     controls.gameplay.SetCallbacks(this);
 }
Exemple #7
0
    // Start is called before the first frame update

    private void Awake()
    {
        controls = new SimpleControls();
        controls.gameplay.move.canceled  += ctx => isNotMoving();
        controls.gameplay.move.performed += ctx => IsMoving();
    }