public void DeSerializeSettings(AstarSerializer serializer) { //width = (int)serializer.GetValue ("Width",typeof(int)); //depth = (int)serializer.GetValue ("Depth",typeof(int)); //height = (float)serializer.GetValue ("Height",typeof(float)); unclampedSize = (Vector2)serializer.GetValue ("unclampedSize",typeof(Vector2)); cutCorners = (bool)serializer.GetValue ("cutCorners",typeof(bool)); neighbours = (NumNeighbours)serializer.GetValue ("neighbours",typeof(int)); rotation = (Vector3)serializer.GetValue ("rotation",typeof(Vector3)); nodeSize = (float)serializer.GetValue ("nodeSize",typeof(float)); collision = (GraphCollision)serializer.GetValue ("collision",typeof(GraphCollision)); center = (Vector3)serializer.GetValue ("center",typeof(Vector3)); maxClimb = (float)serializer.GetValue ("maxClimb",typeof(float)); maxClimbAxis = (int)serializer.GetValue ("maxClimbAxis",typeof(int),1); maxSlope = (float)serializer.GetValue ("maxSlope",typeof(float),90.0F); erodeIterations = (int)serializer.GetValue ("erodeIterations",typeof(int)); penaltyAngle = (bool)serializer.GetValue ("penaltyAngle",typeof(bool)); penaltyAngleFactor = (float)serializer.GetValue ("penaltyAngleFactor",typeof(float)); penaltyPosition = (bool)serializer.GetValue ("penaltyPosition",typeof(bool)); penaltyPositionOffset = (float)serializer.GetValue ("penaltyPositionOffset",typeof(float)); penaltyPositionFactor = (float)serializer.GetValue ("penaltyPositionFactor",typeof(float)); aspectRatio = (float)serializer.GetValue ("aspectRatio",typeof(float),1F); textureData = serializer.GetValue ("textureData",typeof(TextureData)) as TextureData; if (textureData == null) textureData = new TextureData (); #if UNITY_EDITOR Matrix4x4 oldMatrix = matrix; #endif GenerateMatrix (); SetUpOffsetsAndCosts (); #if UNITY_EDITOR if (serializer.onlySaveSettings) { if (oldMatrix != matrix && nodes != null) { AstarPath.active.AutoScan (); } } #endif //Debug.Log ((string)serializer.GetValue ("SomeString",typeof(string))); //Debug.Log ((Bounds)serializer.GetValue ("SomeBounds",typeof(Bounds))); }
public override void DeserializeSettings (GraphSerializationContext ctx) { base.DeserializeSettings(ctx); aspectRatio = ctx.reader.ReadSingle(); rotation = ctx.DeserializeVector3(); center = ctx.DeserializeVector3(); unclampedSize = (Vector2)ctx.DeserializeVector3(); nodeSize = ctx.reader.ReadSingle(); collision.DeserializeSettings(ctx); maxClimb = ctx.reader.ReadSingle(); maxClimbAxis = ctx.reader.ReadInt32(); maxSlope = ctx.reader.ReadSingle(); erodeIterations = ctx.reader.ReadInt32(); erosionUseTags = ctx.reader.ReadBoolean(); erosionFirstTag = ctx.reader.ReadInt32(); autoLinkGrids = ctx.reader.ReadBoolean(); neighbours = (NumNeighbours)ctx.reader.ReadInt32(); cutCorners = ctx.reader.ReadBoolean(); penaltyPosition = ctx.reader.ReadBoolean(); penaltyPositionFactor = ctx.reader.ReadSingle(); penaltyAngle = ctx.reader.ReadBoolean(); penaltyAngleFactor = ctx.reader.ReadSingle(); penaltyAnglePower = ctx.reader.ReadSingle(); isometricAngle = ctx.reader.ReadSingle(); uniformEdgeCosts = ctx.reader.ReadBoolean(); }