public void Load(StreamReader input) { String s = input.ReadToEnd(); int i; for (i = 0; i < s.Length; i++) { if (s[i] == '\n') { size.X = i - 1; break; } } size.Y = (s.Length + 2) / (i + 1); terrain = new Terrain[size.X * size.Y]; fog = new bool[size.X * size.Y]; for (int w = 0; w < fog.Length; w++) { fog[w] = true; } ExtendedTexture[] textureTemplates = new ExtendedTexture[4]; textureTemplates[0] = Textures.GetTextureReference("Terrain_Dunes"); textureTemplates[1] = Textures.GetTextureReference("Terrain_Mountain"); textureTemplates[2] = Textures.GetTextureReference("Terrain_Rock"); textureTemplates[3] = Textures.GetTextureReference("Terrain_Spice"); int j = 0; for (i = 0; i < s.Length; i++) { switch (s[i]) { case '0': terrain[j].LogicalValue = 0; terrain[j].texture = textureTemplates[terrain[j].LogicalValue]; break; case '1': terrain[j].LogicalValue = 1; terrain[j].texture = textureTemplates[terrain[j].LogicalValue]; break; case '2': terrain[j].LogicalValue = 2; terrain[j].texture = textureTemplates[terrain[j].LogicalValue]; break; case '3': terrain[j].LogicalValue = 3; terrain[j].texture = textureTemplates[terrain[j].LogicalValue]; break; default: j--; break; } j++; if (j >= terrain.Length) { break; } } }
public Unit(Houses.House race, int userID, Vector3 position, int maxHealth, float viewRange, ExtendedTexture extendedTexture, int buildSpeed, float speed, string name) : base(race, userID, position, Houses.CalculateHealth(race, maxHealth), viewRange, extendedTexture, buildSpeed, name) { this.speed = Houses.CalculateSpeed(race, speed); this.direction = new Vector2(1.0f, 0.0f); moving = false; selected = false; }
public BaseObject(Houses.House race, int userID, Vector3 position, int maxHealth, float viewRange, ExtendedTexture extendedTexture, int buildSpeed, string name) { this.name = name; this.race = race; this.objectID.userID = userID; this.objectID.objectID = BaseObject.GetNewID(); this.position = position; this.maxHealth = maxHealth; this.currentHealth = 1; this.viewRange = viewRange; this.extendedTexture = new ExtendedTexture(extendedTexture); this.isBeingBuilt = true; this.buildSpeed = buildSpeed; this.selectTexture = new ExtendedTexture(GlobalData.objectSelected); }
public static void Add(string str, ExtendedTexture texture) { Textures.textures.Add(str, texture); }