private void LinkColumnInDirection(int X, int Y, CellLink.Directions Direction, int CX, int CY) { if (this.check(X, Y, 0)) this.forRect(X, Y, 0, 1, 1, this.depth, (c, x, y, z) => { if (c.Navigatable) DetectConnectedInColumn(c, Direction, CX, CY); }); }
public MoveAction(Cell Start, CellLink.Directions Direction) { SplinePoints = new Vector3[3]; var startCell = Start; SplinePoints[0] = startCell.CenterPoint; var linkIndex = startCell.Links.FindIndex(l => l.Direction == Direction); if (linkIndex >= 0 && linkIndex < startCell.Links.Count) { var link = startCell.Links[linkIndex]; SplinePoints[1] = link.EdgePoint; if (link.Neighbor == null) Done = true; else SplinePoints[2] = link.Neighbor.CenterPoint; } else Done = true; }
public override void WriteJson(JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer) { Newtonsoft.Json.JsonSerializer serializerHelper = new Newtonsoft.Json.JsonSerializer(); serializerHelper.Formatting = Newtonsoft.Json.Formatting.None; serializerHelper.MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore; serializerHelper.DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat; serializerHelper.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; serializerHelper.ContractResolver = new ContractResolver(); serializerHelper.Converters.Add(new JsonEnumTypeConverter()); CellLink cellLink = (CellLink)value; if (cellLink.IsNull) { writer.WriteNull(); } else { serializerHelper.Serialize(writer, value); } }
private void DetectConnectedInColumn(Cell From, CellLink.Directions Direction, int CX, int CY) { if (CX < 0 || CX >= this.width || CY < 0 || CY >= this.height) return; var baseMesh = From.NavigationMesh; forRect(CX, CY, 0, 1, 1, this.depth, (neighbor, x, y, z) => { if (neighbor.Navigatable) { var coincidentEdge = Gem.Geo.Mesh.FindCoincidentEdge(neighbor.NavigationMesh, baseMesh); if (coincidentEdge.HasValue) From.Links.Add(new CellLink { Direction = Direction, Neighbor = neighbor, EdgePoint = (coincidentEdge.Value.P0 + coincidentEdge.Value.P1) / 2.0f, LinkZOffset = 0.0f }); } }); }
private void RemoveLinksFromColumn(int X, int Y, CellLink.Directions Direction) { if (this.check(X, Y, 0)) this.forRect(X, Y, 0, 1, 1, this.depth, (c, x, y, z) => { if (c.Links != null) c.Links.RemoveAll(l => l.Direction == Direction); }); }