public static List <GameObject> Collect <T>(this IEntities entities) { var targets = new List <GameObject>(); entities.With <T>((o, x) => targets.Add(o)); return(targets); }
public static List <GameObject> Collect <T1, T2>(this IEntities entities) { var collection1 = entities.Collect <T1>(); var collection2 = entities.Collect <T2>(); return(collection1.Intersect(collection2).ToList()); }
public void Draw(IEntities entities, SpriteBatch sprites) { entities.With <BorderTexture>((o, b) => { Resources.Put(b.Value.GetHashCode().ToString(), b.Value); sprites.Draw(b.Value, null, o.Transform.ToRectangle(), null, null, o.Transform.Rotation.Value * .017453292519f, new Vector2(1, 1)); }); }
public static void Where <T>(this IEntities entities, Predicate <T> condition, Action <T> action) { var targets = new List <GameObject>(); entities.With <T>((o, x) => x.If(condition(x), () => targets.Add(o))); targets.ForEach(o => o.With(action)); }
public void Draw(IEntities entities, SpriteBatch sprites) { entities.Collect <Sprite>() .ForEach(t => t.With <Sprite>(s => sprites.Draw(Resources.Load <Texture2D>(s.Name), null, t.Transform.ToRectangle(), null, null, GetRotation(t), new Vector2(1, 1), null, SpriteEffects.None, GetDepth(t)))); }
public void Draw(IEntities entities) { entities.ForEach( e => e.With <TextDisplay>( text => e.With <Spatial2>( spatial => UI.DrawTextCentered(text.Text(), spatial.Transform.ToRectangle(), text.Color, text.Font)))); }
public NewDLLFunctions(EntityDictionary entityDictionary, Wrapper wrapper, IServerInterface serverInterface, IEntities serverEntities) { EntityDictionary = entityDictionary ?? throw new ArgumentNullException(nameof(entityDictionary)); Wrapper = wrapper ?? throw new ArgumentNullException(nameof(wrapper)); ServerInterface = serverInterface ?? throw new ArgumentNullException(nameof(serverInterface)); ServerEntities = serverEntities ?? throw new ArgumentNullException(nameof(serverEntities)); }
private List <GameObject> GetColliderObjects(IEntities entities) { var colliderObjs = new List <GameObject>(); entities.With <BoxCollider>((o, x) => colliderObjs.Add(o)); return(colliderObjs); }
public void Update(IEntities entities, TimeSpan delta) { if (Keyboard.GetState().GetPressedKeys().Contains(Keys.Escape)) { GameInstance.TheGame.Exit(); } }
public void Update(IEntities entities, TimeSpan delta) { _unprocessedControls.ForEach( ctrl => entities.With <Controls>( (o, ctrls) => ctrls.OnControl(ctrl))); _unprocessedControls.Clear(); }
private static string GetServiceRoot(IEntities entities) { var origin = entities.Request.Context.Client; var hostAndPath = $"{origin.Host}{Settings.Instance.Uri}-odata"; return(origin.HTTPS ? $"https://{hostAndPath}" : $"http://{hostAndPath}"); }
public void Update(IEntities entities, TimeSpan delta) { entities.With <StepTrigger>((o, trigger) => o.With <OnCollision>(onCollision => onCollision.GameObject.Get <Collision>().CollidingWith .ForEach(x => onCollision.Action(x)))); }
public void Update(IEntities entities, TimeSpan delta) { _mouse = _mouse.Current(); if (!_mouse.IsOnGameScreen) { return; } entities.WithTopMost <MouseStateActions>(_mouse.WorldPosition, (o, m) => { if (!o.World.Intersects(_mouse.WorldPosition)) { m.Exit(); } else if (!o.World.Intersects(_mouse.LastWorldPosition)) { m.Hover(); } else if (_mouse.JustPressed(m.Button)) { m.Click(); } else if (_mouse.JustReleased(m.Button)) { m.Release(); } }, (o, m) => m.Exit()); }
public static void WithTopMost <T>(this IEntities entities, Point point, Action <GameObject, T> action) { Collect <T>(entities) .Where(o => o.Transform.Intersects(point)) .OrderByDescending(o => o.Transform.ZIndex) .FirstAsOptional() .IfPresent(o => o.With <T>(x => action(o, x))); }
public void BuyGame(IEntities game, IEntities user) { foreach (var sale in _saleServices) { sale.Discount(game); } Console.WriteLine("Tebrikler! " + user.Name + " Oyunu başarıyla aldınız : " + game.Name); }
public void Update(IEntities entities, TimeSpan delta) { entities.With <MotionAnimationStates>( (obj, motionStates) => obj.With <MotionState>( motionState => obj.With <Motion2>( motion => obj.With <Animation>( animation => EnsureCorrectAnimation(motionStates, motion, motionState, animation))))); }
// ReSharper disable once TooManyDependencies public ReferenceReader(IReader reader, IReferenceMaps maps, IEntities entities, TypeInfo definition, IClassification classification) : base(reader) { _maps = maps; _entities = entities; _definition = definition; _classification = classification; }
public void Update(IEntities game) { foreach (var logger in _loggerGameServices) { logger.Update(game); } Console.WriteLine(game.Name + " : Oyun Güncellendi"); }
public void Update(IEntities entities, TimeSpan delta) { var min = new MinHeight(); entities.Collect <ZGravity>() .OrderBy(x => x.Transform.ZIndex) .ForEach(x => Update(min, x)); }
public void Update(IEntities user) { foreach (var logger in _loggerUserServices) { logger.Update(user); } Console.WriteLine(user.Name + " : Oyuncu Güncellendi"); }
public void Update(IEntities entities, TimeSpan delta) { Update(delta); var inputs = _newInputs.Copy(); _newInputs.Clear(); entities.With <TypingInput>((o, t) => t.If(t.IsActive, () => ProcessAllInputs(inputs, t))); }
public void Delete(IEntities user) { foreach (var logger in _loggerUserServices) { logger.Delete(user); } Console.WriteLine(user.Name + " : Oyuncu Silindi"); }
public Repository(IEntities context) { if (context == null) { throw new ArgumentNullException("context"); } this.context = context; }
public virtual void Dispose(bool disposing) { if (disposing) { context.Dispose(); context = null; } }
public void Delete(IEntities game) { foreach (var logger in _loggerGameServices) { logger.Delete(game); } Console.WriteLine(game.Name + " : Oyun Silindi"); }
private static void RepositionCards(IEntities entities, Hand hand, List <Vector2> positions) { hand.Cards().ForEachIndex((cardId, i) => entities.With <Transform2>(cardId, (obj, CardTransform) => { CardTransform.Center = positions[i]; CardTransform.ZIndex = i; })); }
/// <summary> /// /// </summary> /// <param name="context"></param> protected Manager(IEntities context) { if (context == null) { throw new ArgumentNullException("context"); } DataContext = context; }
public void Draw(IEntities entities, SpriteBatch sprites, IViewport viewport) { entities.With <BorderTexture>((o, b) => { var screenPosition = viewport.GetScreenPosition(o.World.Expanded(new Size2(b.Width, b.Width))); sprites.Draw(b.Value, screenPosition.ToRectangle(), null, Color.White, screenPosition.Rotation.Radians, Vector2.Zero, SpriteEffects.None, (screenPosition.ZIndex - 1).AsDepth()); }); }
public void Update(IEntities entities, TimeSpan delta) { entities.With <Motion2>((o, motion) => o.With <Collision>(collision => { if (o.Get <Collision>().IsBlocking&& collision.CollidingWith.Any(x => x.Get <Collision>().IsBlocking)) { motion.Velocity.Speed = 0; } })); }
public void Update(IEntities entities, TimeSpan delta) { entities.With <Mortal>( (o, mortal) => o.With <Health>( (health) => { if (health.HP < 1) { mortal.OnDeath(); } })); }
public EntityLinkMaterialiser(IEntityLinks entityLinks, IEntities entities) { _entityLinks = entityLinks; _entities = entities; }
public EntityLinkValidator(IEntityLinks entityLinks, IEntities entities) { _entityLinks = entityLinks; _entities = entities; }