public void adjustTarget() { switch (gameSceneController.getRoomDirection()) { case Directions.Up: targetPosition.x = transform.position.x; targetPosition.y = transform.position.y - gameSceneController.getBounds().height / 2 - getSize().y / 2;; break; case Directions.Down: targetPosition.x = transform.position.x; targetPosition.y = transform.position.y + gameSceneController.getBounds().height / 2 + getSize().y / 2;; break; case Directions.Left: targetPosition.y = transform.position.y; targetPosition.x = transform.position.x + gameSceneController.getBounds().width / 2 + getSize().x / 2; break; case Directions.Right: targetPosition.y = transform.position.y; targetPosition.x = transform.position.x - gameSceneController.getBounds().width / 2 - getSize().x / 2; break; } }
private void adjustSpawnArea() { if (gameSceneController != null) { switch (gameSceneController.getRoomDirection()) { case Directions.Right: bounds = new Rect(transform.position.x, transform.position.y - horizontalSpawnHeight / 2, horizontalSpawnWidth, horizontalSpawnHeight); break; case Directions.Left: bounds = new Rect(transform.position.x - horizontalSpawnWidth, transform.position.y - horizontalSpawnHeight / 2, horizontalSpawnWidth, horizontalSpawnHeight); break; case Directions.Up: bounds = new Rect(transform.position.x - verticalSpawnWidth / 2, transform.position.y, verticalSpawnWidth, verticalSpawnHeight); break; case Directions.Down: bounds = new Rect(transform.position.x - verticalSpawnWidth / 2, transform.position.y - verticalSpawnHeight, verticalSpawnWidth, verticalSpawnHeight); break; } } }