コード例 #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();
         }
     }
 }
コード例 #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));
        }
    }
コード例 #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);
 }
コード例 #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));
            }
        }
コード例 #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);
 }
コード例 #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);
        }
    }
コード例 #7
0
 private void CastCooldown(ref CastCommand Cast)
 {
     Cast.CurrentCooldown = Cast.MaxCooldown;
 }