Exemplo n.º 1
0
        protected override void DoTheLogic()
        {
            //			Debug.Log (casting + "casting is ");
            //			Debug.Log (cooldown + "casting is ");
            var targets = _world.GetEnemyUnitsTo(_unit.Alliance);

            Target = new UnitTarget(targets.GetClosestUnit1(_unit));             //make this the correct target finder


            if (CanCast(_unit) && _unit.IsAlive)                 //doesn't check for target being in range here
            {
                SetCastTick();
                Cast();
            }

            if (casting == true)
            {
                if (!_unit.IsAlive)                   //conditions to stop cast
                {
                    CastCancel();
                }
                if (CastFinalTick())
                {
                    CastCancel();
                    Execute();
                    SetCooldownTick();
                }
            }

            if (CooldownTickCheck())
            {
                CoolDownCancel();
            }
        }
        protected override void DoTheLogic()
        {
//			Debug.Log (casting + "casting is ");
//			Debug.Log (cooldown + "casting is ");
            var targets = _world.GetEnemyUnitsTo(_unit.Alliance);

            Target = new UnitTarget(targets.GetClosestUnit1(_unit));             //make this the correct target finder


            if (CanCast(_unit) && _unit.IsAlive && Target != null && _unit.Position.IsInRange(Target.GetPosition(), _data.AbilityRange))
            {
                SetCastTick();
                Cast();
            }

            if (casting == true)
            {
                if (!_unit.IsAlive)                   //conditions to stop cast
                {
                    CastCancel();
                }
                if (CastFinalTick())
                {
                    CastCancel();
                    Execute();
                    SetCooldownTick();
                }
            }

            if (CooldownTickCheck())
            {
                CoolDownCancel();
            }
        }
Exemplo n.º 3
0
        private void FindTarget()
        {
            var targets       = _world.GetEnemyUnitsTo(_unit.Alliance);
            var closestTarget = targets
                                .OrderBy(target => WorldPosition.DistanceSq(_unit.Position, target.Position))
                                .FirstOrDefault();

            if (WorldPosition.DistanceSq(_unit.Position, closestTarget.Position) < 20)
            {
                //cannot do this: must call factory to do this
                target = closestTarget;
            }
        }
Exemplo n.º 4
0
        private void FindTarget()
        {
            var targets       = _world.GetEnemyUnitsTo(_unit.Alliance);
            var closestTarget = targets
                                .OrderBy(target => WorldPosition.DistanceSq(_unit.Position, target.Position))
                                .FirstOrDefault();


            if (closestTarget != null && _worldPos.IsInRange(closestTarget.Position, _abilityData.range))
            {
                //cannot do this: must call factory to do this
                target = closestTarget;
                Debug.Log(closestTarget);
            }
        }
Exemplo n.º 5
0
        public override bool  ExecuteLogic()
        {
            Debug.Log("arrow execute  logic");
            var targets = _world.GetEnemyUnitsTo(_sender.Alliance);              //this is enemy right now

            if (targets == null)
            {
                Debug.Log("(don't have allies) regular situation");
            }
            List <UnitModel> targs = targets.GetAllDistProjectile1(this, (Fix64)10);

            foreach (UnitModel targ in targs)
            {
                var hpPlus = _hPChangeFactory.Create(new StatChangeData {
                    value = damage.value, receiver = targ, sender = _sender
                });
                _command.AddCommand(hpPlus);
                Debug.Log("Im a target" + targ);
            }

            return(true);
        }
        protected override void DoTheLogic()
        {
            var targets = _world.GetEnemyUnitsTo(_unit.Alliance);

            _target = new UnitTarget(targets.GetClosestUnit1(_unit));
        }