public RawVertex GetRawFromVertex(Vertex Vertex) { RawVertex Raw = new RawVertex(); Raw.Position = Vertex.Position; return Raw; }
public VertexScreen(Game game, Vector2 Pos, Texture2D Tex) : base(game) { Ships = new List<Ship>(); this.Tex = Tex; this.Rect = new Rectangle((int)(Pos.X), (int)(Pos.Y), (int)Tex.Width, (int)Tex.Height); Vertex = new Vertex(game, Pos, Tex, this); Components = new List<VertexComponent>(); Backgrounds = new List<Background>(); this.Effect = Renderer.Singleton.Content.Load<Effect>("Glow"); }
public object Clone() { Vertex Tmp = new Vertex(Game, this.Position, this.Tex, this.Parent); return Tmp as object; }
public float GetLenghtFrom(Vertex Vertex) { return Vector2.Distance(this.Position, Vertex.Position); }
public static void Load(Game game, SpriteBatch spriteBatch) { IAsyncResult result = Guide.BeginShowStorageDeviceSelector(PlayerIndex.One, null, null); StorageDevice device = Guide.EndShowStorageDeviceSelector(result); result.AsyncWaitHandle.WaitOne(); StorageContainer container = device.OpenContainer("StorageDemo"); result.AsyncWaitHandle.Close(); string filename = Path.Combine(container.Path, "savegame.sav"); if (!File.Exists(filename)) { // If not, dispose of the container and return. container.Dispose(); return; } // Open the file. FileStream stream = File.Open(filename, FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(SaveGameData)); SaveGameData data = (SaveGameData)serializer.Deserialize(stream); //GeneralManager.Singleton.CurrentLevel = new Level(game, spriteBatch); using (Connection Tmp = new Connection(game)) { int i = 0; foreach (RawConnection v in data.Connections) { Tmp.A = v.A; Tmp.B = v.B; Tmp.Position1 = v.Pos1; Tmp.Position2 = v.Pos2; GeneralManager.Singleton.CurrentLevel.Components.Add(Tmp.Clone() as Connection); i++; } GeneralManager.Singleton.CurrentLevel.ConnectionsCount = i; } using (Vertex Tmp = new Vertex(game, Vector2.Zero, Renderer.Singleton.Content.Load<Texture2D>("indicator"), null)) { int i = 0; foreach (RawVertex v in data.Vertex) { Tmp.Position = v.Position; GeneralManager.Singleton.CurrentLevel.Components.Add(Tmp.Clone() as Vertex); i++; } GeneralManager.Singleton.CurrentLevel.VertexCount = i; } GeneralManager.Singleton.IsLevelInitalized = true; // Close the file. stream.Close(); container.Dispose(); }