public override void Unpack(BinaryReader reader) { Id = reader.ReadUInt32(); uint hasObjects = reader.ReadUInt32(); if (hasObjects == 1) { HasObjects = true; } // Read in the terrain. 9x9 so 81 records. for (int i = 0; i < 81; i++) { var terrain = reader.ReadUInt16(); Terrain.Add(terrain); } // Read in the height. 9x9 so 81 records for (int i = 0; i < 81; i++) { var height = reader.ReadByte(); Height.Add(height); } reader.AlignBoundary(); }
/* * This method creates a terrain to be used */ private void CreateTerrain(string texture, string normal) { connector.SendPacket(Terrain.Add(new[] { 256, 256 }, CreateHeightMap()), new Action <JObject>(data => { Console.WriteLine("Reached the terrain skeleton!"); CreateTerrainTexture(texture, normal); })); }
public override void RestoreClassic() { base.RestoreClassic(); Size = new Point2(15, 15); DefaultTerrain = 0; for (int j = 0; j < 5; j++) { for (int i = -4 + j; i < 5; i++) { Terrain.Add(new Point2(i, j), 1); } } for (int j = 0; j < 4; j++) { for (int i = 0; i < 8 - j; i++) { Terrain.Add(new Point2(-4 + i, -1 - j), 1); } } for (int j = 0; j < 4; j++) { for (int i = 0; i < j + 1; i++) { var a = new Point2(i - 4, -8 + j); var b = new Point2(4 - i, -1 - j); var c = new Point2(5 + i, 1 + j); var d = new Point2(4 - i, 8 - j); var e = new Point2(-4 + i, 1 + j); var f = new Point2(-5 - i, -1 - j); AddStartLocation(a, 0); AddStartLocation(b, 1); AddStartLocation(c, 2); AddStartLocation(d, 3); AddStartLocation(e, 4); AddStartLocation(f, 5); Terrain.Add(a, 1); Terrain.Add(b, 1); Terrain.Add(c, 1); Terrain.Add(d, 1); Terrain.Add(e, 1); Terrain.Add(f, 1); } } }
public void Add(PhysicsObj obj) { Space.Add(obj.Entity); if (obj is ShipObj) { Ships.Add((ShipObj)obj); } else if (obj is MobileObj) { Objects.Add((MobileObj)obj); } else { Terrain.Add(obj); } }
/// <summary> /// Writes a string on top of the scene /// </summary> /// <param name="toWrite">The text to write on the scene</param> /// <param name="location">The location to write the text</param> public void InsertString(string toWrite, Vector location) { foreach (var w in toWrite.Split('\n')) { var charArr = w.ToCharArray(); for (int i = 0; i < charArr.Length; i++) { Terrain.Add(new SingleEntity() { Display = charArr[i] }, new Vector(location.X + i, location.Y)); } location.Y++; } }
public void Add(PhysicsObj obj) { Space.Add(obj.Entity); if (obj is ShipObj) { Ships.Add((ShipObj)obj); } else if (obj is Rocket) { Objects.Add(obj); MessageWriter.ClientEntityCreationMessage(null, NetEntityType.Missile, obj.ID, obj.Position, obj.Orientation, obj.resource_index); } else if (obj is Character) { } else { Terrain.Add(obj); } }