Esempio n. 1
0
    private void Update()
    {
        HorizontalInput = Input.GetAxis("Horizontal");

        if (Input.GetKeyDown(KeyCode.W))
        {
            OnWDown?.Invoke(this, EventArgs.Empty);
        }
        if (Input.GetKeyDown(KeyCode.A))
        {
            OnADown?.Invoke(this, EventArgs.Empty);
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            OnSDown?.Invoke(this, EventArgs.Empty);
        }
        if (Input.GetKeyDown(KeyCode.D))
        {
            OnDDown?.Invoke(this, EventArgs.Empty);
        }
        if (Input.GetKeyDown(KeyCode.Space))
        {
            OnSpaceDown?.Invoke(this, EventArgs.Empty);
        }
    }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         if (OnSpaceDown != null)
         {
             // mainPlane.FireOnce();
             OnSpaceDown.Invoke();
         }
     }
     else if (Input.GetKey(KeyCode.Space))
     {
         // mainPlane.FireStart();
         if (OnSpace != null)
         {
             OnSpace.Invoke();
         }
     }
     else if (Input.GetKeyDown(KeyCode.J))
     {
         OnRevive.Invoke();
         Debug.Log("revive2");
     }
     else if (Input.GetKeyDown(KeyCode.Escape))
     {
         Esc();
     }
     if (OnMovement != null)
     {
         OnMovement.Invoke(new Vector3(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"), 0));
     }
 }
Esempio n. 3
0
    private void Update()
    {
        if (_mainCamera == null)
        {
            _mainCamera = Camera.main;
        }
        MouseWorldPosition = _mainCamera.ScreenToWorldPoint(Input.mousePosition);

        HorizontalAxisValue = Input.GetAxisRaw(_horizontalAxisName);
        VerticalAxisValue   = Input.GetAxisRaw(_verticalAxisName);

        if (Input.GetButtonDown(_actionButtonName))
        {
            OnActionButtonDown?.Invoke(this, EventArgs.Empty);
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            OnSpaceDown?.Invoke(this, EventArgs.Empty);
        }
    }