private void OnSkillActivated(Combatant combatant, ISkill skill) { // Unbind delegates from old skill if (_ranged != null) { _ranged.TargetChanged -= OnTargetChanged; } else if (_directional != null) { _directional.DirectionChanged -= OnDirectionChanged; } // Figure out origin from ActionQueue PawnAction lastAction = _combatant.LastAction; _origin = (lastAction == null) ? _combatant.Position : lastAction.PostRunPosition; // Figure out what kind of skill it is _ranged = skill as RangedSkill; _directional = skill as DirectionalSkill; // Bind delegates to new skill if (_ranged != null) { _ranged.TargetChanged += OnTargetChanged; OnTargetChanged(_ranged.Target); } else if (_directional != null) { _directional.DirectionChanged += OnDirectionChanged; OnDirectionChanged(_directional.Direction); } }
private void OnSkillDeactivated(Combatant combatant, ISkill skill) { _gridField.ClearPoints(); _gridField.RebuildMesh(); _ranged = null; _directional = null; }
public void StartTargeting(ISkill skill) { _skill = (DirectionalSkill)skill; _isTargeting = true; _initialTargeting = true; }