Advertisement
shadowplaycoding

P010_SpaceObjects

Apr 29th, 2017
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class SpaceObjects {
  5.  
  6.     // This method creates a sphere object whether that be a planet or star
  7.     public static GameObject CreateSphereObject(string name, Vector3 position, Transform parent = null)
  8.     {
  9.         GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
  10.         sphere.name = name;
  11.         sphere.transform.position = position;
  12.         sphere.transform.parent = parent;
  13.  
  14.         return sphere;
  15.     }
  16.  
  17.     public static GameObject CreateOrbitPath(GameObject orbitSprite, string name, int orbitNumber, Transform parent = null)
  18.     {
  19.         GameObject orbit = GameObject.Instantiate(orbitSprite);
  20.        
  21.         orbit.name = name;
  22.         orbit.transform.localScale = orbit.transform.localScale * orbitNumber;
  23.         orbit.transform.SetParent(parent);
  24.  
  25.         return orbit;
  26.     }
  27.  
  28.     /*
  29.     Copyright Shadowplay Coding 2017 - see www.shadowplaycoding.com for licensing details
  30.     Removing this comment forfits any rights given to the user under licensing.
  31.     */
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement