public GameArea(int id, int height, int width, int coordinateX, int coordinateY, GameAreaType gameAreaType) { Id = id; Height = height; Width = width; CoordinateX = coordinateX; CoordinateY = coordinateY; GameAreaType = gameAreaType; }
public static Vector3 GetRandomPosition(Transform transform, GameAreaType type, float randomRadius, float squareWidth, float squareDepth, float squareHeight, RaycastHit[] findGroundRaycastHits, int groundLayerMask) { Vector3 randomedPosition = transform.position; switch (type) { case GameAreaType.Radius: randomedPosition += new Vector3(Random.Range(-1f, 1f) * randomRadius, 0, Random.Range(-1f, 1f) * randomRadius); break; case GameAreaType.Square: randomedPosition += new Vector3(Random.Range(-0.5f, 0.5f) * squareWidth, 0, Random.Range(-0.5f, 0.5f) * squareDepth); break; } return(PhysicUtils.FindGroundedPosition(randomedPosition, findGroundRaycastHits, squareHeight, groundLayerMask)); }