GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Silverback/LevelEditor/Pathfinding/Vertex.cs at master · SilverbackSoPra/Silverback Expand file tree/ Copy pathVertex.csMore file actions 97 lines (79 loc) · 3.29 KB / Copy pathVertex.csFile metadata and controls97 lines (79 loc) · 3.29 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.Xna.Framework; using LevelEditor.Collision; namespace LevelEditor.Pathfinding { [Serializable()] public class Vertex: ISerializable { public static int mCounter = 0; public int mVersion; [XmlIgnore] public Vertex mNextVertex; [XmlIgnore] public Vertex mPreviousVertex; public float mCost; public float mHeuristicCost; public int mIterations = 0; public Vector2 Position { get; } public bool Connectable { get; set; } public CollisionRectangle ParentRectangle { get; } public float AngleToCenter { get; set; } public float DistanceToCenter { get; set; } public Edge Edge1 { get; set; } public Edge Edge2 { get; set; } [XmlIgnore] public HashSet<Vertex> mAdjacentVertices; public Vertex(Vector2 position, CollisionRectangle parent) { mVersion = ++mCounter; Position = position; ParentRectangle = parent; Connectable = true; mCost = float.MaxValue; mHeuristicCost = float.MaxValue; mAdjacentVertices = new HashSet<Vertex>(); } public float Angle(Vertex vertex) { return (float)Math.Atan2(vertex.Position.X - Position.X, vertex.Position.Y - Position.Y); } public void GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue("mCounter", mCounter); info.AddValue("mVersion", mVersion); info.AddValue("mNextVertex", mNextVertex); info.AddValue("mPreviousVertex", mPreviousVertex); info.AddValue("mCost", mCost); info.AddValue("mHeuristicCost", mHeuristicCost); info.AddValue("Position", Position); info.AddValue("Connectable", Connectable); info.AddValue("ParentRectangle", ParentRectangle); info.AddValue("AngleToCenter", AngleToCenter); info.AddValue("Edge1", Edge1); info.AddValue("Edge2", Edge2); } public Vertex(SerializationInfo info, StreamingContext context) { mCounter = (int)info.GetValue("mCounter", typeof(int)); mVersion = (int)info.GetValue("mVersion", typeof(int)); mNextVertex = (Vertex)info.GetValue("mNextVertex", typeof(Vertex)); mPreviousVertex = (Vertex)info.GetValue("mPreviousVertex", typeof(Vertex)); mCost = (float)info.GetValue("mCost", typeof(float)); mHeuristicCost = (float)info.GetValue("mHeuristicCost", typeof(float)); Position = (Vector2)info.GetValue("Position", typeof(Vector2)); Connectable = (bool)info.GetValue("Connectable", typeof(bool)); ParentRectangle = (CollisionRectangle)info.GetValue("ParentRectangle", typeof(CollisionRectangle)); AngleToCenter = (float)info.GetValue("AngleToCenter", typeof(float)); Edge1 = (Edge)info.GetValue("Edge1", typeof(Edge)); Edge2 = (Edge)info.GetValue("Edge2", typeof(Edge)); } public Vertex() { } } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |