private List <Plot> Plots; // List of 'Plot' class objects for fast slide re-loading // Initialising the program void Start() { GameObject Camera = GameObject.FindGameObjectWithTag("MainCamera"); // Fetch the Camera object which is a child of the "Player" Object. NBodyPlotter = Camera.GetComponent <NBodyPlotter>(); // Assign the NBodyPlotter.cs script attached to the Camera object to variable name "NBodyPlotter" NBodyPlotter.enabled = false; // NBodyPlotter.cs should be disabled anyway but just in case... // Set the parameters from the inspector NBodyPlotter.m_numBodies = m_numBodies; NBodyPlotter.m_spacingScale = m_spacingScale; NBodyPlotter.m_zOffset = m_zOffset; NBodyPlotter.m_neighbourRadius = m_neighbourRadius; NBodyPlotter.m_defaultMass = m_defaultMass; Plots = new List <Plot>(0); // Initialise the list as empty DirectoryInfo dir = new DirectoryInfo(Application.streamingAssetsPath); // Obtain the Directory path of the StreamingAssets folder bundles with the game build ParticleData = dir.GetFiles("*.csv"); // Populate the FileInfo array with the files in the directory. NBodyPlotter.m_particleDataFile = ParticleData[currentFileIndex]; // Set the file to be loaded to the first one (currentFileIndex was initialised to 0) NBodyPlotter.SetPlots(Plots); // Set the variable 'Plots' in NBodyPlotter to the (empty) list held in this script. NBodyPlotter.enabled = true; // Launch the program! Plots = NBodyPlotter.ReturnPlots(); // Update the list of Plots with the loaded slide. }
private bool RightBumperDown; // decrease colour scaling precision void Start() { // Fetch the needed scripts from the "Player" object GameObject Player = GameObject.FindGameObjectWithTag("Player"); CyclePlots = Player.GetComponent <CyclePlots>(); // Fetch the needed scripts from the "MainCamera" object _Camera = GameObject.FindGameObjectWithTag("MainCamera"); NBodyPlotter = _Camera.GetComponent <NBodyPlotter>(); }
private bool RightArrowDown; // load up the next file void Start() { // Fetch the needed scripts from the "Player" object GameObject Player = GameObject.FindGameObjectWithTag("Player"); CyclePlots = Player.GetComponent <CyclePlots>(); ControllerInput = Player.GetComponent <SimpleXboxControllerInput>(); MouseAndControllerLook = Player.GetComponent <SimpleSmoothMouseAndControllerLook>(); MouseAndControllerLook.enabled = false; // disable MouseAndControllerLook by default to avoid disorientation of the person with the headset on // Fetch the needed script from the "Main Camera" object GameObject Camera = GameObject.FindGameObjectWithTag("MainCamera"); NBodyPlotter = Camera.GetComponent <NBodyPlotter>(); }