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(); } } }
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)); } }
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); }
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)); } }
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); }
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); } }
private void CastCooldown(ref CastCommand Cast) { Cast.CurrentCooldown = Cast.MaxCooldown; }