Пример #1
0
    public void OnFire(InputAction.CallbackContext context)
    {
        TurretGuns turret = Interactable as TurretGuns;

        if (turret != null)
        {
            turret.OnFire(context);
        }
    }
Пример #2
0
    private void Update()
    {
        //moving
        if (_axis.x < 0)
        {
            _playerSpriteRenderer.flipX = false;
            animator.SetBool("IsMoving", true);
            animator.SetBool("IsIdle", false);
            animator.SetBool("IsClimb", false);
            animator.SetBool("UsingTurret", false);
        }
        else if (_axis.x > 0)
        {
            _playerSpriteRenderer.flipX = true;
            animator.SetBool("IsMoving", true);
            animator.SetBool("IsIdle", false);
            animator.SetBool("IsClimb", false);
            animator.SetBool("UsingTurret", false);
        }
        //not moving
        else
        {
            animator.SetBool("IsMoving", false);
            animator.SetBool("IsIdle", true);
        }
        //climbing
        if (_axis.y != 0.0f)
        {
            animator.SetBool("IsClimb", true);
            animator.SetBool("IsMoving", false);
            animator.SetBool("IsIdle", false);
            animator.SetBool("UsingTurret", false);
        }
        //not climbing
        else
        {
            animator.SetBool("IsClimb", false);
        }
        //using Turret
        TurretGuns turret = Interactable as TurretGuns;

        if (turret != null)
        {
            animator.SetBool("UsingTurret", true);
            animator.SetBool("IsClimb", false);
            animator.SetBool("IsMoving", false);
            animator.SetBool("IsIdle", false);
            animator.SetBool("IsHoldItem", false);
        }
        else
        {
            animator.SetBool("UsingTurret", false);
        }
        //player death
        //animator.SetBool("IsDeath", !_healthSystem.IsAlive);

        _delayTimeToRegen += Time.deltaTime;
        if (_delayTimeToRegen >= _playerData.DelayTimeRegen)
        {
            _delayTimeToRegen = 0.0f;
            HealthReneration();
        }
    }