void Start()
 {
     GlobalLineWidthSlider.value      = DefaultLineWidth;
     GlobalShapeToleranceSlider.value = DefaultTolerance;
     JDI = JsonManager.GetComponent <JsonDataImport>();
     // JsonDataImport JDI = JsonManager.GetComponent<JsonDataImport>();
     AM = AudioManager.GetComponent <MyAudioManager>();
     HA = JsonManager.GetComponent <HeightAdjust>();
 }
        protected override void Initialize()
        {
            base.Initialize();

            HeightAdjustThread = new Thread(HeightAdjustWorkerThread);
            HeightAdjustThread.IsBackground = true;

            Declaration = new VertexDeclaration(CustomLandscapeVertex.VertexElements);

            // Create our vertices
            Verts = new CustomLandscapeVertex[Width * Height];

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    Vector3 position  = new Vector3(x, 0, y);
                    Vector2 texCoords = new Vector2((float)x / Width, (float)y / Height);
                    Vector3 normal    = new Vector3(0, 1, 0);

                    Verts[x + y * Width] = new CustomLandscapeVertex(position, normal, texCoords);
                }
            }

            // Create our vertex buffer
            vb = new VertexBuffer(GraphicsDevice, Declaration, Verts.Length, BufferUsage.None);
            vb.SetData(Verts);

            // Create our indices
            Indices = new int[(Width - 1) * (Height - 1) * 6];

            for (int x = 0; x < Width - 1; x++)
            {
                for (int y = 0; y < Height - 1; y++)
                {
                    // Triangle 1
                    Indices[(x + y * (Width - 1)) * 6]     = (x + 1) + (y + 1) * Width;
                    Indices[(x + y * (Width - 1)) * 6 + 1] = (x + 1) + y * Width;
                    Indices[(x + y * (Width - 1)) * 6 + 2] = x + y * Width;

                    // Triangle 2
                    Indices[(x + y * (Width - 1)) * 6 + 3] = (x + 1) + (y + 1) * Width;
                    Indices[(x + y * (Width - 1)) * 6 + 4] = x + y * Width;
                    Indices[(x + y * (Width - 1)) * 6 + 5] = x + (y + 1) * Width;
                }
            }

            TriangleCount = Indices.Length / 3;

            // Create and Set our Index Buffer
            ib = new IndexBuffer(GraphicsDevice, IndexElementSize.ThirtyTwoBits, (Width - 1) * (Height - 1) * 6, BufferUsage.WriteOnly);
            ib.SetData(Indices);

            OnAdjustHeight += AdjustHeight;
        }
    private void Start()
    {
        LabelText.text = OrbitManager.gameObject.name;
        OM             = OrbitManager.GetComponent <OrbitManagement>();
        TM             = OrbitManager.GetComponent <TimeManipulator>();
        JsonManager    = GameObject.FindGameObjectWithTag("JsonManager");
        HeightAdjust HA = JsonManager.GetComponent <HeightAdjust>();

        Pedestal            = HA.Pedestal;
        MainSatelliteCanvas = HA.MainSatelliteCanvas;
        MainMenuCanvas      = HA.MainMenuCanvas;
        AudioManager        = GameObject.FindGameObjectWithTag("AudioManager");
        AM = AudioManager.GetComponent <MyAudioManager>();
    }
        public override void Initialize()
        {
            HeightAdjustThread = new Thread(HeightAdjustWorkerThread);
            HeightAdjustThread.IsBackground = true;

            AmbientLightColor     = Color.White;
            AmbientLightIntensity = 1.0f;

            DiffuseLightDirection = new Vector3(-1, -1, 0);
            DiffuseLightColor     = Color.White;
            DiffuseLightIntensity = 1.0f;

            SetShaderParameters += OnLandscapeShaderParams;
            OnAdjustHeight      += AdjustHeight;

            base.Initialize();
        }
Beispiel #5
0
    void Start()
    {
        GlobalLineWidthSlider.value      = DefaultLineWidth;
        GlobalShapeToleranceSlider.value = DefaultTolerance;
        JDI = JsonManager.GetComponent <JsonDataImport>();
        // JsonDataImport JDI = JsonManager.GetComponent<JsonDataImport>();
        AM = AudioManager.GetComponent <MyAudioManager>();
        HA = JsonManager.GetComponent <HeightAdjust>();

        // WHY ARE THESE OBSOLETED?
        //GlobalScaleSlider.value = JDI.ScaleValue;
        //NewScaleValue = (int)GlobalScaleSlider.value;
        //CoordinatesText.text = "Coordinates: " + JDI.orbitalDataUnity.Info.Coordinates;
        //UnitsText.text = "Units: " + JDI.orbitalDataUnity.Info.Units;

        //defaults
        //UseTimeStepToggle.isOn = true;
        //TimeStepSlider.value = (float)timeSteps[3];    // 1 min
    }