Beispiel #1
0
        public override void Execute()
        {
            var targets            = _world.GetAllyUnitsTo(_unit.Alliance);
            List <UnitModel> targs = targets.GetAllDistUnit1(_unit, _data.AbilityRange);

            foreach (UnitModel targ in targs)
            {
                var giveShield = _statChangeFactory.Create(StatChanges.AddedShield, new StatChangeData {
                    value = (Fix64)_data.ShieldValue, receiver = targ, sender = _unit
                });
                _command.AddCommand(giveShield);
                //this is when I have to start putting more logic in the commands, because it ain't goin here.
            }
        }
Beispiel #2
0
        private void FindTarget()
        {
            var targets       = _world.GetAllyUnitsTo(_unit.Alliance);
            var closestTarget = targets
                                .Where(target => target != _unit)
                                .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);
            }
        }
        public override bool ExecuteLogic()
        {
            Debug.Log("arrow execute  logic");
            var targets = _world.GetAllyUnitsTo(_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);
        }