Exemplo n.º 1
0
    private void HandleAim()
    {
        if (Global.Player[(int)Index].FireController.GetCanShoot())
        {
            if (_masterInput.GetButtonDown(Index, Ds4Button.Square))
            {
                AimDuration = 0;
                IsAiming    = true;
            }
            if (_masterInput.GetButton(Index, Ds4Button.Square))
            {
                AimDuration += Time.deltaTime;
                Aim.SetPositions(new[] { Vector3.zero, new Vector3(0, 0, AimDuration) });

                _energyHandler.SetHoldingShot(true, AimDuration);
                IsAiming = false;
                _energyHandler.TryToShoot();
            }
            else if (_masterInput.GetButtonUp(Index, Ds4Button.Square))
            {
                Aim.SetPositions(new[] { Vector3.zero, Vector3.zero });
                IsAiming = false;

                _energyHandler.TryToShoot();
                AimDuration = 0;
            }
        }
    }