Exemple #1
0
 void StopAttack()
 {
     _pControl.disableMovement = false;
     OnUpdate -= attacks[currentAttack].OnUpdate;
     attacks[currentAttack].OnAttackEnd -= StopAttack;
     currentAttack = -1;
 }
Exemple #2
0
 void Damage()
 {
     noDamageTimer += Time.deltaTime;
     if (noDamageTimer > TimeInvulnerable)
     {
         _pSystem.Stop();
         isDamaged     = false;
         noDamageTimer = 0;
         OnUpdate     -= Damage;
     }
 }
Exemple #3
0
    public void onAttack(int value)
    {
        if (currentAttack != -1 && attacks[currentAttack].isAttackPlaying)
        {
            return;
        }

        _pControl.disableMovement = true;
        currentAttack             = value;
        attacks[currentAttack].Start();
        OnUpdate += attacks[currentAttack].OnUpdate;
        attacks[currentAttack].OnAttackEnd += StopAttack;
    }
Exemple #4
0
 public void OnDamaged(float damage, Transform player)
 {
     if (!isDamaged && !isBlocking)
     {
         _pSystem.Play();
         isDamaged              = true;
         _pSystem.maxParticles += (int)(maxParticles + (multiplicator * 10));
         multiplicator         += damage;
         Vector3 dir = player.transform.position - _transform.position;
         _pControl.ScaleCheck(dir);
         _rigidbody.AddForce(-dir * damage * 1000 * multiplicator);
         OnUpdate += Damage;
     }
 }