Пример #1
0
 // Update is called once per frame
 void FixedUpdate()
 {
     if (attacks.Count == 0)
     {
         return;
     }
     TTA -= Time.fixedDeltaTime;
     if (currentAttack == null)
     {
         if (TTA < 0)
         {
             currentAttack = ChooseAttack();
             SetTransitionColorEffect(baseColor, currentAttack.attackColor);
             currentAttack.AttStart();
             TTA = currentAttack.duration;
         }
     }
     else
     {
         if (TTA > 0)
         {
             currentAttack.AttUpdate(TTA);
         }
         else
         {
             currentAttack.AttEnd();
             SetTransitionColorEffect(currentAttack.attackColor, baseColor);
             currentAttack = null;
             TTA           = timeBetweenAttacks;
         }
     }
 }
Пример #2
0
    // Update is called once per frame
    public void UpdateAttack()
    {
        if (isLocalPlayer)
        {
        }

        if (!isServer)
        {
            return;
        }

        if (attacks.Count == 0)
        {
            return;
        }
        TTA -= Time.fixedDeltaTime;
        if (CurrentAttack == null)
        {
            if (TTA < 0)
            {
                CurrentAttack = ChooseAttack();
                SetTransitionColorEffect(baseColor, CurrentAttack.attackColor);
                CurrentAttack.AttStart();
                TTA = CurrentAttack.duration;
            }
        }
        else
        {
            if (TTA > 0)
            {
                CurrentAttack.AttUpdate(TTA);
            }
            else
            {
                CurrentAttack.AttEnd();
                SetTransitionColorEffect(CurrentAttack.attackColor, baseColor);
                CurrentAttack = null;
                TTA           = timeBetweenAttacks;
            }
        }
    }