Пример #1
0
    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);
        }
    }
Пример #2
0
 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;
 }