Beispiel #1
0
 protected override void OnUpdate(float dTime)
 {
     currentCastTime += dTime;
     if (currentCastTime >= ActiveSkill.EarlyBreakTime)
     {
         Unit.RotatingState.AddPauser(Unit.CastingState);
     }
     if (currentCastTime >= ActiveSkill.CastTime && !hasCasted)
     {
         ActiveSkill.Cast(Unit, TargetInfo);
         if (castEvent != null)
         {
             castEvent(new CastEventArgs(this));
         }
         hasCasted = true;
     }
     if (currentCastTime >= ActiveSkill.TotalCastTime)
     {
         if (!lastCommand.IsInterrupt && ActiveSkill.HasNextCombo)
         {
             currentCommand = null;
             Start(lastCommand);
         }
         else
         {
             Reset();
         }
     }
 }
Beispiel #2
0
    protected override void OnStart()
    {
        /*if(Unit.name == "Player") Debug.Log(
         *  "castTarget: " + TargetInfo.TargetUnit.name +
         *  " ||| activeSkill: " + ActiveSkill.UniqueName +
         *  " ||| combo: " + comboCounter.ToString());*/
        Debug.Assert(currentCommand != null && currentCommand.IsValid());

        if (lastCommand != null && lastCommand.Skill == currentCommand.Skill)
        {
            comboCounter++;
        }
        currentCommand.Skill.RegisterCombo(comboCounter);

        if (currentCommand.Skill.Data.BlockRotation)
        {
            Unit.RotatingState.AddPauser(Unit.CastingState);
        }
        else
        {
            Unit.RotatingState.RemovePauser(Unit.CastingState);
        }

        Unit.MovingState.ResetTarget();

        lastCommand     = currentCommand;
        currentCastTime = 0;
        hasCasted       = false;
        if (startCastEvent != null)
        {
            startCastEvent(new CastEventArgs(this));
        }
    }
Beispiel #3
0
 protected override void OnReset()
 {
     currentCommand  = null;
     lastCommand     = null;
     currentCastTime = 0;
     comboCounter    = 0;
     hasCasted       = false;
     if (resetCastEvent != null)
     {
         resetCastEvent(new CastEventArgs(this));
     }
     //Debug.Log("Resetting" + Unit.name);
 }
Beispiel #4
0
        public override bool Equals(object obj)
        {
            CastCommand other = (CastCommand)obj;

            if (other == null)
            {
                return(false);
            }
            else
            {
                return
                    (type == other.type &&
                     skill == other.skill &&
                     targetInfo.Equals(other.targetInfo));
            }
        }
Beispiel #5
0
 private TryStartResult Start(CastCommand command)
 {
     if (!command.Equals(currentCommand))
     {
         if (command.IsValid())
         {
             currentCommand = command;
             Start();
             return(TryStartResult.Start);
         }
         else
         {
             Reset();
             return(TryStartResult.Reset);
         }
     }
     return(TryStartResult.None);
 }
Beispiel #6
0
    public TryStartResult TryStart(CastCommand command)
    {
        if (command == null)
        {
            return(TryStartResult.None);
        }
        switch (GetState())
        {
        case State.Interruptable:
            return(Start(command));

        case State.NonInterruptable:
            lastCommand = command;
            return(TryStartResult.Save);

        default:
            return(TryStartResult.None);
        }
    }
Beispiel #7
0
 private void CastCooldown(ref CastCommand Cast)
 {
     Cast.CurrentCooldown = Cast.MaxCooldown;
 }