Advertisement
shadowplaycoding

P004_SolarSystem

Apr 29th, 2017
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class SolarSystem : MonoBehaviour {
  5.  
  6.     public static SolarSystem SolarSystemInstance;
  7.  
  8.     void OnEnable()
  9.     {
  10.         SolarSystemInstance = this;
  11.     }
  12.  
  13.     // Use this for initialization
  14.     void Start () {
  15.    
  16.     }
  17.    
  18.     // Update is called once per frame
  19.     void Update () {
  20.  
  21.         Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
  22.         RaycastHit hit = new RaycastHit();
  23.  
  24.         if (Physics.Raycast(mouseRay, out hit) && Input.GetMouseButtonDown(0))
  25.         {
  26.             Star star = Galaxy.GalaxyInstance.ReturnStarFromGameObject(hit.transform.gameObject);
  27.             Debug.Log("This Star is Called: " + star.starName + "\n" + "It Has " + star.numberOfPlanets + " Planets");
  28.         }
  29.  
  30.     }
  31.  
  32.     /*
  33.    Copyright Shadowplay Coding 2017 - see www.shadowplaycoding.com for licensing details
  34.    Removing this comment forfits any rights given to the user under licensing.
  35.    */
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement