// Use this for initialization void Start() { if (leftWall != null) { ScreenSpaceUtilities.PlaceGameobjectAtBound(Bound.left, leftWall, offset); } if (rightWall != null) { ScreenSpaceUtilities.PlaceGameobjectAtBound(Bound.right, rightWall, offset); } if (topWall != null) { ScreenSpaceUtilities.PlaceGameobjectAtBound(Bound.top, topWall, offset); } if (bottomWall != null) { ScreenSpaceUtilities.PlaceGameobjectAtBound(Bound.bottom, bottomWall, offset); } }
// Use this for initialization void Start() { if (topBoundedKillzone != null) { ScreenSpaceUtilities.PlaceGameobjectAtBound(Bound.top, topBoundedKillzone.gameObject, offset); } if (bottomBoundedKillzone != null) { ScreenSpaceUtilities.PlaceGameobjectAtBound(Bound.bottom, bottomBoundedKillzone.gameObject, offset); } if (leftBoundedKillzone != null) { ScreenSpaceUtilities.PlaceGameobjectAtBound(Bound.left, leftBoundedKillzone.gameObject, offset); } if (rightBoundedKillzone != null) { ScreenSpaceUtilities.PlaceGameobjectAtBound(Bound.right, rightBoundedKillzone.gameObject, offset); } }
/// <summary> /// Places the gameobject transform at screen space bound. /// </summary> /// <param name="bound">Bound.</param> public static void PlaceGameobjectAtBound(Bound bound, GameObject obj, float offset = 0) { switch (bound) { case Bound.bottom: obj.transform.position = ScreenSpaceUtilities.GetBottomBoundCoordinate() + new Vector3(0, -offset, 0); break; case Bound.top: obj.transform.position = ScreenSpaceUtilities.GetTopBoundCoordinate() + new Vector3(0, offset, 0); break; case Bound.left: obj.transform.position = ScreenSpaceUtilities.GetLeftBoundCoordinate() + new Vector3(-offset, 0, 0); break; case Bound.right: obj.transform.position = ScreenSpaceUtilities.GetRightBoundCoordinate() + new Vector3(offset, 0, 0); break; default: break; } }