Пример #1
0
    // Update is called once per frame
    void Update()
    {
        Mouvement();

        if (Input.GetMouseButtonDown(0) && isGrounded() == true)
        {
            _palyerAnim.Attack();
        }
    }
Пример #2
0
    void CheckAttack()
    {
        _grounded = IsGrounded();

        if (_grounded && CrossPlatformInputManager.GetButtonDown("A_Button"))
        {
            _anim.Attack();
        }
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        Movement();

        if (Input.GetMouseButtonDown(0) && IsGrounded() == true || Input.GetKeyDown(KeyCode.RightControl) && IsGrounded() == true)
        {
            _playerAnim.Attack();
        }
    }
Пример #4
0
    // Update is called once per frame
    void Update()
    {
        Movement();

        if (Input.GetMouseButtonDown(0))
        {
            _playerAnim.Attack();
        }
    }
Пример #5
0
 void Update()
 {
     Movement();
     //CheckGrounded();
     if (Input.GetMouseButtonDown(0) && CheckGrunded() == true)
     {
         _anim.Attack();
     }
 }
Пример #6
0
    void Attack()
    {
        isGrounded = IsGrounded();

        if (CrossPlatformInputManager.GetButtonDown("A_Button") && isGrounded)
        {
            playerAnimation.Attack();
        }
    }
Пример #7
0
 void Attack()
 {
     _grounded = IsGrounded();
     if (Input.GetKeyDown(KeyCode.Mouse0) && _grounded)
     {
         _rb.velocity = new Vector2(0, _rb.velocity.y);
         _playerAnimation.Attack();
     }
 }
Пример #8
0
    // Update is called once per frame

    void Update()
    {
        Movement();

        if (Input.GetMouseButtonDown(0) && IsGrounded())
        {
            anim.Attack();
        }
    }
Пример #9
0
    // Update is called once per frame
    void Update()
    {
        Movement();

        if (Input.GetButtonDown("Fire1"))
        {
            _playAnim.Attack();
        }
    }
Пример #10
0
    void Attack()
    {
        RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.down, 0.8f, 1 << 8);

        if (Input.GetKeyDown(KeyCode.Mouse0) && hit.collider != null)
        {
            _anim.Attack();
        }
    }
Пример #11
0
 void Update()
 {
     Movement();
     //Atağı A butonun aayarladık
     if (CrossPlatformInputManager.GetButtonDown("A_Button") && IsGrounded() == true)
     {
         _playerAnim.Attack();
     }
 }
Пример #12
0
    // Update is called once per frame
    void Update()
    {
        Movement();

        if (CrossPlatformInputManager.GetButtonDown("A_Button") && IsGrounded())
        {
            _playerAnim.Attack();
        }
    }
Пример #13
0
    // Update is called once per frame
    void Update()
    {
        Movement();

        if (Input.GetMouseButtonDown(0) && IsGrounded())
        {
            _playerAnimation.Attack();
        }
    }
Пример #14
0
    private void Update()
    {
        Movement();

        if (CrossPlatformInputManager.GetButtonDown("A_Button") && IsGrounded() && Health > 0)
        {
            PlayerAnimation.Attack();
            SwordAttackSound.pitch = Random.Range(0.9f, 1.1f);
            SwordAttackSound.Play();
        }
    }
Пример #15
0
    private void PerformAttack() //fire laser/bullet
    {
        /*
         * if (!onGround)
         * {
         *  return;
         * }
         */
        if (myVelocity.x != 0)
        {
            return;
        }

        /* //this was for shooting a bullet, but my guy swings a sword so it's not what I want
         * Debug.Log("shoot laser/bullet");
         * Vector3 pos = firePoint.transform.position;
         * Quaternion rot = firePoint.transform.rotation;
         *
         * if (getLastDirection() == "up")
         * {
         *  Debug.Log(getLastDirection());
         *  pos.x = 0 + this.transform.position.x;
         *  pos.y = 2.1f + this.transform.position.y;
         *  rot = Quaternion.Euler(0, 0, 90);
         *
         * }
         * if (getLastDirection() == "down")
         * {
         *  Debug.Log(getLastDirection());
         *  pos.x = 0 + this.transform.position.x;
         *  pos.y = -0.1f + this.transform.position.y;
         *  rot = Quaternion.Euler(0, 0, -90);
         * }
         * if (getLastDirection() == "right")
         * {
         *  Debug.Log(getLastDirection());
         *  pos.x = 0.7f + this.transform.position.x;
         *  pos.y = 0.9f + this.transform.position.y;
         *  rot = Quaternion.Euler(0, 0, 0);
         * }
         * if (getLastDirection() == "left")
         * {
         *  Debug.Log(getLastDirection());
         *  pos.x = -0.8f + this.transform.position.x;
         *  pos.y = 0.9f + this.transform.position.y;
         *  rot = Quaternion.Euler(0, 0, 180);
         *
         * }
         * GameObject bullet = Instantiate(bulletPrefab, pos, rot);
         * Destroy(bullet, 0.5f);
         */
        _playerAnim.Attack();
        //cue attack animation
    }
Пример #16
0
    void Attack()
    {
        if (!canAttack)
        {
            return;
        }
                #if MOBILE_INPUT
        if (CrossPlatformInputManager.GetButtonDown("Attack") && IsGrounded())
        {
            m_playerAnim.Attack();
        }
                #endif

                #if !MOBILE_INPUT
        if (Input.GetMouseButtonDown(0) && IsGrounded())
        {
            m_playerAnim.Attack();
        }
                #endif
    }
Пример #17
0
    void Attack()
    {
        if (!canAttack)
        {
            return;
        }

        if ((CrossPlatformInputManager.GetButtonDown("A_Button")) && IsGrounded())
        {
            m_playerAnim.Attack();
        }
    }
Пример #18
0
    // Update is called once per frame
    void Update()
    {
        Movement();
        isGrounded();

        if (CrossPlatformInputManager.GetButtonDown("A_button") && _grounded == true) //   Input.GetMouseButtonDown(0)
        {
            StartCoroutine(afterswing());
            _playerAnim.Attack();
            onHitPlayPlayer.Play();
        }
    }
Пример #19
0
    private void Attack(bool isGrounded)
    {
        bool attack = CrossPlatformInputManager.GetButtonDown("A_Button") || Input.GetMouseButtonDown(1);

        if (attack)
        {
            if (isGrounded)
            {
                _playerAnimation.Attack();
            }
        }
    }
Пример #20
0
    // Update is called once per frame
    void Update()
    {
        var move = Movement();

        _rigid.velocity = new Vector2(move * _speed, _rigid.velocity.y);

        _playerAnimation.Move(move);

        if (CrossPlatformInputManager.GetButtonDown("A_Button") && IsGrounded() == true)
        {
            _playerAnimation.Attack();
        }
    }
Пример #21
0
    // Update is called once per frame
    void Update()
    {
        if (_isDead)
        {
            return;
        }
        Movement();

        if (CrossPlatformInputManager.GetButtonDown("A_Button") && isGrounded())
        {
            _playerAnim.Attack();
        }
    }
Пример #22
0
    private void Attack()
    {
        FindObjectOfType <AudioManager>().Play("SwordSwing");
        anim.Attack();

        Collider2D[] enemiesToDamage = Physics2D.OverlapCircleAll(
            attackPos.position, attackRange, whatIsEnemy);

        foreach (var enemy in enemiesToDamage)
        {
            enemy.GetComponent <Enemy>().TakeDamage(damage);
        }
    }
Пример #23
0
    void FixedUpdate()
    {
        isGrounded();                                   //Check if player is on ground
        Movement();                                     //Handle Movement

        if (verticalInput != 0 && isGrounded() == true) //Jump Conditions
        {
            Jump();                                     //Jump Method
        }
        if (attack == true && isGrounded() == true)     //Attack Conditions
        {
            playerAnimation.Attack();                   //playerAnimation class call method
        }
    }
Пример #24
0
    public void Attack()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            playerAnimation.Attack(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));

            for (int i = 0; i < enemyInRange.Count; i++)
            {
                if (!enemyInRange[i].gameObject.GetComponent <EnemyStats>().dead)
                {
                    enemyInRange[i].gameObject.GetComponent <EnemyStats>().Hit();
                }
            }
        }
    }
Пример #25
0
 void HandleAnimations()
 {
     if (actionAnimator == "MOVE")
     {
         pAnim.Movement(movement.moving);
     }
     else if (actionAnimator == "ATTACK")
     {
         pAnim.Attack();
     }
     else
     {
         pAnim.Movement(false);
     }
 }
Пример #26
0
    // Update is called once per frame
    private void Update()
    {
        if (isDead)
        {
            return;
        }

        Move();

        CheckGrounded();

        if (Input.GetKeyDown(KeyCode.Mouse0) && isGrounded)
        {
            pAnimation.Attack();
        }
    }
Пример #27
0
    void Update()
    {
        if ((playerMovement.isRunning && Input.GetButtonDown("Fire1")) || Input.GetButtonDown("Fire3"))
        {
            playerAnimation.Attack();
            attackCollider.enabled = true;
        }

        if (timer >= impactTime)
        {
            timer = 0f;
            attackCollider.enabled = false;
        }

        if (attackCollider.enabled)
        {
            timer += Time.deltaTime;
        }
    }
Пример #28
0
    // Update is called once per frame
    private void Update()
    {
        if (_isDead)
        {
            return;
        }

        Movement();

        if (/*Input.GetMouseButtonDown(0) || */ CrossPlatformInputManager.GetButtonDown("A_Button") && IsGrounded())
        {
            if (!GameManager.Instance.FlameEnabled)
            {
                _playerAnim.Attack();
            }
            else
            {
                _playerAnim.FlameAttack();
            }
        }
    }
Пример #29
0
    void Movement()
    {
        float move = Input.GetAxisRaw("Horizontal");

        Flip(move);

        if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Mouse0) && _grounded)
        {
            _playerAnim.Attack();
        }

        if (Input.GetKeyDown(KeyCode.Space) && _grounded == true)
        {
            _rigid.velocity  = new Vector2(_rigid.velocity.x, _jumpForce);
            _grounded        = false;
            _resetJumpNeeded = true;
            StartCoroutine(ResestJumpNeededRoutine());
            _playerAnim.Jump(true);
        }
        _rigid.velocity = new Vector2(move * _speed, _rigid.velocity.y);
        _playerAnim.Move(move);
    }
Пример #30
0
    private void Movement()
    {
        float Hmove = Input.GetAxisRaw("Horizontal");
        float Vmove = Input.GetAxisRaw("Vertical");

        _grounded = Isground();
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            _Movedirection.Attack();
        }
        if (Input.GetKeyDown(KeyCode.Space) && Isground() == true)
        {
            _rg.velocity = new Vector2(_rg.velocity.x, _jumpheight);
            _Movedirection.Jump(true);
            StartCoroutine(changjumpanim());
        }
        Flip(Hmove);

        _rg.velocity = new Vector2(Hmove * _Speed, _rg.velocity.y);

        _Movedirection.Move(Hmove);
    }