Example #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;
         }
     }
 }
Example #2
0
 private void RegisterAttack(CuboidAttack a)
 {
     attacks.Add(a);
     if (priorityBasedChoosing)
     {
         int pr = a.priority > 0 ? a.priority : 0;
         prioritiesCumulative.Add(prioritiesSum + pr);
         prioritiesSum += pr;
     }
 }
Example #3
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;
            }
        }
    }