Beispiel #1
0
		public Sprite SpriteForStructure(Models.Structures structureModel) {

			int x, y;

			//Currently a hack to get string name from structure.structureType
			string spriteName = structureModel.Type + "";

			if (structureModel.LinksToNeighbor == false) {
				//Since the object does not bother with connectivity to its neighbors it is assumed to have only one sprite
				//later iterations can randomize this to some extent
				return SpriteNameMap [spriteName + "_1"];
			}


			//Get the coordinates for the surface on which the structure is created
			x = structureModel.SurfaceModel.X;
			y = structureModel.SurfaceModel.Y;

			//Get spritename based on links to neighbors
			spriteName += "_";
			spriteName += level.CheckForStructureConnections (x, y, structureModel.Type);


			if (SpriteNameMap.ContainsKey (spriteName) == false) {
				Debug.Log ("Views.Levels --> SpriteForStructure : Cannot find sprite with name " + spriteName);
				//FIXME: Should return a placeholder of somekind or a null value?
				return null;
			} else {
				return SpriteNameMap [spriteName];
			}
		}