Beispiel #1
0
        public void ApplyModifier(Target target, Modifier modifier)
        {
            switch (target.TargetType)
            {
            case TargetType.Entity:
                ApplyModifier(((EntityTarget)target).TargetName, modifier);
                break;

            case TargetType.Point:
                throw new NotImplementedException();

            case TargetType.Area:
                var areaTarget = (AreaTarget)target;

                //Create array because elements in dictionary could get removed in the process.
                var entities = m_Entities.Values.ToArray();
                foreach (Entity entity in entities)
                {
                    if (areaTarget.IsEntityInArea(entity))
                    {
                        modifier.ApplyEffect(entity);
                        log.InfoFormat("Applying aoe to {0}.", entity.Name);
                    }
                }
                break;
            }
        }
Beispiel #2
0
        public void ApplyModifier(string target, Modifier modifier)
        {
            Entity entity = null;

            m_Entities.TryGetValue(target, out entity);
            if (entity == null)
            {
                log.InfoFormat("Trying to apply modifier on {0} but {0} doesn't exist.", target);
                return;
            }
            modifier.ApplyEffect(entity);
        }