protected SinglePointTileContainmantManager(GameState game, IPositionable subject) { this.game = game; this.subject = subject; this.Update(); }
public HitResult? Shoot(GameState game, bool hitBuildings = true, bool hitProjectileColliders = false) { HitResult? result = null; var bestF = 1f; foreach (var tile in game.Level.CastRay(this)) { if (!tile.IsValid) continue; var info = tile.Value; if (hitBuildings) { foreach (var building in info.Buildings) { var r = building.TryHit(this); selectBetterResult(ref result, ref bestF, r); } } if (hitProjectileColliders) { foreach (var collider in info.ProjectileColliders) { var r = collider.TryHit(this); selectBetterResult(ref result, ref bestF, r); } } } return result; }
public ProjectileColliderTileManager(GameState game, IProjectileCollider collider) { this.game = game; this.collider = collider; this.Update(); }
public CollidingParticle(GameState game, Position2 position, Velocity2 velocity, Unit z, Speed vz, bool collideWithProjectileColliders) : base(game) { this.data = new Data(position, velocity, z, vz, collideWithProjectileColliders); }
protected override void OnLoad(EventArgs e) { this.renderer = new GameRenderer(); this.game = new GameState(); InputManager.Initialize(this.Mouse); }
public Building(GameState game, Position2 topLeft, Difference2 size) : base(game) { this.TopLeft = topLeft; this.Size = size; this.listAs<Building>(); }
public MergedIntersection(GameState game, params Intersection[] intersections) : base(game) { this.intersections = intersections.ToList(); this.Intersections = this.intersections.AsReadOnly(); this.listAs<MergedIntersection>(); }
public void Draw(GameState game) { this.surfaces.ModelviewMatrix.Matrix = Matrix4.LookAt( new Vector3(0, 0, 50), new Vector3(0, 0, 0), new Vector3(0, 1, 0) ); game.Render(); }
public HitResult? Shoot(GameState game, bool hitBuildings, bool hitProjectileColliders, bool debugDraw) { var result = this.Shoot(game, hitBuildings, hitProjectileColliders); if (debugDraw) this.drawDebug(result); return result; }
public Civilian(GameState game) : base(game) { this.sprite = (Sprite2DGeometry)GeometryManager.Instance.GetSprite("bloob").Geometry; this.controller = new CivilianController(game, this); this.eventListenerTileManager = new GameEventListenerTileManager(game, this); this.initialised = true; }
public Street(GameState game, Intersection node1, Intersection node2, Unit width) : base(game) { this.Node1 = node1; this.Node2 = node2; this.Width = width; node1.AddStreet(this); node2.AddStreet(this); this.listAs<Street>(); }
public Centipede(GameState game, int length = 15) : base(game) { this.head = new CentiHead(game); this.tailPath.AddFirst(new CentiPathPart(this.head.Position, 0.U())); for (int i = 0; i < length; i++) { this.parts.Add(new Centipart(game)); } }
public Level(GameState game, float width, float height) { var w = width + levelPadding * 2; var h = height + levelPadding * 2; var tilesX = Mathf.CeilToInt(w / gridSize); var tilesY = Mathf.CeilToInt(h / gridSize); this.tilemap = new Tilemap<TileInfo>(tilesX, tilesY); this.offsetX = -tilesX * gridSizeHalf; this.offsetY = -tilesY * gridSizeHalf; this.fillTiles(); this.fillBuildingsIntoTiles(game); }
public GameEventListenerTileManager(GameState game, IGameEventListener listener) : base(game, listener) { this.node.Value = listener; }
public HitResult? Update(GameState game, TimeSpan time) { var vDelta = this.velocity * time; var hitResult = new Ray(this.position, vDelta) .Shoot(game, true, this.collideWithProjectileColliders); var f = hitResult.HasValue ? hitResult.Value.RayFactor : 1; var zDelta = this.vz * time; var z = this.z + zDelta; if (z < 0.U()) { f = this.z / zDelta; z = 0.U(); hitResult = new HitResult(this.position + vDelta * f, Direction2.Zero, f, false); } this.position += vDelta * f; this.z = z; this.vz += game.Gravity * time; return hitResult; }
private void fillBuildingsIntoTiles(GameState game) { foreach (var building in game.GetList<Building>()) { foreach (var tile in this.TilesIntersecting(building.TopLeft, building.Size)) { tile.Value.AddBuilding(building); } } }
public Data UpdateTo(GameState game, TimeSpan time, out HitResult? hitResult) { hitResult = this.Update(game, time); return this; }