private OrthoDir DirectionRelativeToCamera() { MapCamera cam = Application.isPlaying ? Global.Instance().Maps.camera : FindObjectOfType <MapCamera>(); Vector3 ourScreen = cam.cam.WorldToScreenPoint(transform.position); Vector3 targetWorld = ((MapEvent3D)parent).TileToWorldCoords(parent.location + facing.XY()); targetWorld.y = parent.transform.position.y; Vector3 targetScreen = cam.cam.WorldToScreenPoint(targetWorld); Vector3 delta = targetScreen - ourScreen; return(OrthoDirExtensions.DirectionOf2D(new Vector2(delta.x, -delta.y))); }
public override OrthoDir DirectionTo(Vector2Int position) { return(OrthoDirExtensions.DirectionOf2D(position - this.Position)); }