Exemple #1
0
    public void OnUpdate()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (_player.isGrounded)
            {
                _soundMananger.SoundPlay((int)sounds.JUMP);
            }
            _movement.Jump();
        }

        float h = Input.GetAxis("Horizontal");
        float v = Input.GetAxis("Vertical");

        if (v != 0 || h != 0)
        {
            _animatorMananger.Move(true);

            _movement.Move(v, h);
        }
        else
        {
            _animatorMananger.Move(false);
        }



        if (Input.GetKeyDown(KeyCode.G) && _player.CanAttack)
        {
            _battle.Attack();
            _animatorMananger.Attack();
            _soundMananger.SoundPlay((int)sounds.ATTACK);
        }

        //test SaveLoad
        if (Input.GetKeyDown(KeyCode.F2))
        {
            SaveCheckPoint();
        }
        if (Input.GetKeyDown(KeyCode.F3))
        {
            LoadCheckPoint();
        }
    }
Exemple #2
0
    public void GetHit(float damage)
    {
        if (shieldOn)
        {
            return;
        }
        _soundMananger.SoundPlay((int)2);

        if (life <= 0)
        {
            _animatorMananger.Die();
            this.enabled = false;
        }

        if (!invencibility)
        {
            life -= damage;
        }
        StartCoroutine(Invencibility(1f));
        _animatorMananger.GetHit();
    }