Inheritance: MonoBehaviour
Exemple #1
0
    public float m_defaultMass   = 0.001f;          // Mass attributed to all particles for non-file ICs



    // Initialising the program
    void Start()
    {
        GameObject Camera = GameObject.FindGameObjectWithTag("MainCamera");         // Fetch the Camera object which is a child of the "Player" Object.

        NBodySim         = Camera.GetComponent <NBodySim>();                        // Assign the NBodyPlotter.cs script attached to the Camera object to variable name "NBodyPlotter"
        NBodySim.enabled = false;                                                   // NBodyPlotter.cs should be disabled anyway but just in case...

        // cast the enum to an int
        initialConditionIndex = (int)m_initialCondition;

        // Assign variables from inspector to NBodySim
        NBodySim.m_initialCondition = initialConditionIndex;
        NBodySim.m_numBodies        = m_numberOfParticles;
        NBodySim.m_spacingScale     = m_spacingScale;
        NBodySim.m_velocityScaling  = m_velocityScaling;
        NBodySim.m_zOffset          = m_zOffset;
        NBodySim.m_paused           = m_paused;
        NBodySim.m_softeningSquared = m_softeningSquared;
        NBodySim.m_maxColorSpeed    = m_maxColorSpeed;
        NBodySim.m_defaultMass      = m_defaultMass;

        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.
        try { NBodySim.m_particleDataFile = ParticleData[currentFileIndex]; }           // Set the file to be loaded to the first one (currentFileIndex was initialised to 0)
        catch
        {
            NBodySim.m_particleDataFile = null;
            filesPresent          = false;
            initialConditionIndex = (int)IC.TWO_CUBES;
        }

        NBodySim.enabled = true;
    }
    void Start()
    {
        // Fetch the needed scripts from the "Player" object
        GameObject Player = GameObject.FindGameObjectWithTag("Player");

        CycleICs = Player.GetComponent <CycleInitialConditions>();

        // Fetch the needed scripts from the "MainCamera" object
        _Camera  = GameObject.FindGameObjectWithTag("MainCamera");
        NBodySim = _Camera.GetComponent <NBodySim>();
    }
    private bool RightArrowDown;    // load up the next file

    void Start()
    {
        // Fetch the needed scripts from the "Player" object
        GameObject Player = GameObject.FindGameObjectWithTag("Player");

        MouseAndControllerLook = Player.GetComponent <SimpleSmoothMouseAndControllerLook>();
        ControllerInput        = Player.GetComponent <SimpleXboxControllerInput>();
        CycleICs = Player.GetComponent <CycleInitialConditions>();

        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");

        NBodySim = Camera.GetComponent <NBodySim>();
    }
Exemple #4
0
 private void Awake()
 {
     nBodySim    = GetComponent <NBodySim>();
     audioSource = GetComponent <AudioSource>();
 }