private void UpdateSword()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         sword.Attack();
     }
 }
Beispiel #2
0
    protected override void Attack()
    {
        //si il est pu devant faut le pourchasser
        if (Player.position.x > this.transform.position.x)
        {
            transform.localRotation = Quaternion.Euler(-90, 0, 0);
        }
        else
        {
            transform.localRotation = Quaternion.Euler(-90, 180, 0);
        }
        Vector3 tmp = new Vector3(transform.position.x, transform.position.y + 1, transform.position.z);

        if (!IsAttacking && Vector3.Distance(tmp, Player.position) > Stat.PlayerDist + 0.2f)
        {
            UpdateIndex = (int)EAIState.MOVE;
            Anim.SetBool("Walk", true);
            return;
        }
        AtkTimer += Time.deltaTime;
        if (AtkTimer >= Stat.AtkSpeed)
        {
            Hand.Attack();
            Anim.SetTrigger("Attack");
            IsAttacking = true;
            AtkTimer    = 0;
        }
    }
Beispiel #3
0
 public void TryAtk()
 {
     if (Input.GetButtonDown("Fire2"))
     {
         _animator.SetTrigger("Attack");
         Sword.Attack();
     }
 }
 void Update()
 {
     if (playerSensor.hot && Time.timeSinceLevelLoad >= nextAttack && !sword.isAttacking)
     {
         sword.Attack();
         nextAttack = Time.timeSinceLevelLoad + attackDelay;
     }
 }
Beispiel #5
0
    private void Update()
    {
        inputs.UpdateInputs();

        FlipSprite();

        sword.Attack(inputs.sword);
    }