private float GetRightDistance(Vector4 boundingBox) { float result = 1280 - boundingBox.Z; if (result < 0) { result = 0; } List <KeyValuePair <float, List <MapTile> > > list = this.mapTiles.VSortedTiles; int index = MapTiles.FindIndexSortedTiles(boundingBox.Z, list); if (index == list.Count) { return(result); } for (int i = index; i < list.Count; ++i) { foreach (MapTile tile in list[i].Value) { if (IsVerticalValid(boundingBox, tile) == true) { return(Math.Abs(list[i].Key - boundingBox.Z)); } } } return(result); }
private float GetBottomDistance(Vector4 boundingBox) { float result = 720f - boundingBox.W; if (result < 0) { result = 0; } List <KeyValuePair <float, List <MapTile> > > list = this.mapTiles.HSortedTiles; int index = MapTiles.FindIndexSortedTiles(boundingBox.W, list); if (index == list.Count) { return(result); } for (int i = index; i < list.Count; ++i) { foreach (MapTile tile in list[i].Value) { if (IsHorizontalValid(boundingBox, tile) == true) { return(Math.Abs(list[i].Key - boundingBox.W)); } } } return(result); }
public Map() { this.background = new Background(); this.mapTiles = new MapTiles("Map_" + ((int)(Global.gMapState)).ToString("00") + ".xml"); CreateBox(); this.decors = new Decors("Map_" + ((int)(Global.gMapState)).ToString("00") + ".xml"); Global.gMap = this; }
public bool HasNextBottomEdge(Vector4 boundingBox) { List <KeyValuePair <float, List <MapTile> > > list = this.mapTiles.HSortedTiles; int index = MapTiles.FindIndexSortedTiles(boundingBox.W, list); ++index; for (int i = index; i < list.Count; ++i) { foreach (MapTile tile in list[i].Value) { if (IsHorizontalValid(boundingBox, tile) == true) { return(true); } } } return(false); }
private float GetLeftDistance(Vector4 boundingBox) { float result = boundingBox.X; if (result < 0) { result = 0; } List <KeyValuePair <float, List <MapTile> > > list = this.mapTiles.VSortedTiles; int index = MapTiles.FindIndexSortedTiles(boundingBox.X, list); if (index == list.Count) { return(result); } if (list[index].Key == boundingBox.X) { foreach (MapTile tile in list[index].Value) { if (IsVerticalValid(boundingBox, tile) == true) { return(0); } } } for (index = index - 1; index > -1; --index) { foreach (MapTile tile in list[index].Value) { if (IsVerticalValid(boundingBox, tile) == true) { return(Math.Abs(list[index].Key - boundingBox.X)); } } } return(result); }
public bool isFront(Vector4 boundingBox) { List <KeyValuePair <float, List <MapTile> > > list = this.mapTiles.HSortedTiles; int index = MapTiles.FindIndexSortedTiles(boundingBox.W, list); for (int i = index; i < list.Count; ++i) { foreach (MapTile tile in list[i].Value) { if (IsHorizontalValid(boundingBox, tile) == true) { if (tile.Sprite2D.Depth == 0.3f) { return(true); } else { return(false); } } } } return(false); }