Exemple #1
0
 public CRSpawn(ICRCommand[] commands)
 {
     _commands = commands;
 }
Exemple #2
0
 public void Update()
 {
     if ((null == _active || _active.isComplete()) && !_creature.isDead())
     {
         if (_commands.Count > 0)
         {
             _active = _commands.Dequeue();
             _active.start();
         }
         else
         {
             _active = null;
         }
     }
 }
Exemple #3
0
    public void useAbility(int index, CRController target)
    {
        CRAbility ability = creature.abilityManager.GetAbility(index);

        if (!ability)
            return;

        if (_abilityBehaviour.isCasting())
            return;

        _commands.Clear();

        if (null != _active)
        {
            _active = null;
        }

        if (ability.cancelAutoAttack || (_attackBehaviour.isAttacking && ability.pauseAutoAttack))
        {
            _commands.Enqueue(new CRAutoAttack(_attackBehaviour, false));
        }

        if (target != this && ability.targetType != CRAbilityTargetType.SELF)
        {
            _commands.Enqueue(new CRSpawn( new ICRCommand[] {
                                                new CRFollow(_movementBehaviour, target.transform),
                                                new CRUseAbility(_abilityBehaviour, ability, target)
                                           }
            ));

            if (ability.triggerAutoAttack)
            {
                _commands.Enqueue(new CRSpawn( new ICRCommand[] {
                                                new CRFollow(_movementBehaviour, target.transform),
                                                new CRAttack(_attackBehaviour, target)
                                           }
                ));
            }
        }
        else
        {
            _commands.Enqueue(new CRUseAbility(_abilityBehaviour, ability, target));
        }

        if (!ability.cancelAutoAttack && _attackBehaviour.isAttacking && ability.pauseAutoAttack)
        {
            _commands.Enqueue(new CRAutoAttack(_attackBehaviour, true));
        }
    }
Exemple #4
0
    public void stop()
    {
        _commands.Clear();

        if (null != _active)
        {
            _active.cancel();

            _active = null;
        }

        _attackBehaviour.stop();
    }