Exemplo n.º 1
0
    //private Transform _transform;

    void Start()
    {
        //_transform = transform;
        VectorLine.canvas.sortingOrder = -1;

        VectorLine.SetCanvasCamera(Camera.main);
    }
	void Start () {
		// Make a bunch of points in a spherical distribution
		var starPoints = new Vector3[numberOfStars];
		for (int i = 0; i < numberOfStars; i++) {
			starPoints[i] = Random.onUnitSphere * 100.0f;
		}
		// Make each star have a size ranging from 1.5 to 2.5
		var starSizes = new float[numberOfStars];
		for (int i = 0; i < numberOfStars; i++) {
			starSizes[i] = Random.Range (1.5f, 2.5f);
		}
		// Make each star have a random shade of grey
		var starColors = new Color32[numberOfStars];
		for (int i = 0; i < numberOfStars; i++) {
			var greyValue = Random.value * .75f + .25f;
			starColors[i] = new Color(greyValue, greyValue, greyValue);
		}
		
		stars = new VectorLine("Stars", new List<Vector3>(starPoints), 1.0f, LineType.Points);
		stars.SetColors (new List<Color32>(starColors));
		stars.SetWidths (new List<float>(starSizes));
	
		stars.Draw();
		// We want the stars to be drawn behind 3D objects, like a skybox. So we use SetCanvasCamera,
		// which makes the canvas draw with RenderMode.OverlayCamera using Camera.main.
		// Note that SetCanvasCamera should be called after the VectorLine is drawn,
		// or else the VectorLine won't be drawn correctly.
		VectorLine.SetCanvasCamera (Camera.main);
		VectorLine.canvas.planeDistance = Camera.main.farClipPlane-1;
	}
Exemplo n.º 3
0
 private void Start()
 {
     Vector3[] vector3Array = new Vector3[this.numberOfStars];
     for (int index = 0; index < this.numberOfStars; ++index)
     {
         vector3Array[index] = Vector3.op_Multiply(Random.get_onUnitSphere(), 100f);
     }
     float[] numArray = new float[this.numberOfStars];
     for (int index = 0; index < this.numberOfStars; ++index)
     {
         numArray[index] = Random.Range(1.5f, 2.5f);
     }
     Color32[] color32Array = new Color32[this.numberOfStars];
     for (int index = 0; index < this.numberOfStars; ++index)
     {
         float num = (float)((double)Random.get_value() * 0.75 + 0.25);
         color32Array[index] = Color32.op_Implicit(new Color(num, num, num));
     }
     this.stars = new VectorLine("Stars", new List <Vector3>((IEnumerable <Vector3>)vector3Array), 1f, (LineType)2);
     this.stars.SetColors(new List <Color32>((IEnumerable <Color32>)color32Array));
     this.stars.SetWidths(new List <float>((IEnumerable <float>)numArray));
     this.stars.Draw();
     VectorLine.SetCanvasCamera(Camera.get_main());
     VectorLine.get_canvas().set_planeDistance(Camera.get_main().get_farClipPlane() - 1f);
 }
Exemplo n.º 4
0
    void Start()
    {
        //StartCoroutine ("CreateUsersTesting");

        VectorLine.SetCanvasCamera(Camera.main);
        VectorLine.canvas.renderMode = RenderMode.WorldSpace;
    }
Exemplo n.º 5
0
Arquivo: ODM.cs Projeto: SHZ66/AOT2d
    // Use this for initialization
    void Start()
    {
        rb   = GetComponent <Rigidbody2D>();
        anim = GetComponent <Animator>();
        //rope_renderer = GetComponent<LineRenderer>();
        rope_renderer = new VectorLine("Rope", new List <Vector3> {
            new Vector3(), new Vector3(), new Vector3()
        }, RopeWidth, LineType.Continuous);

        rope_renderer.Draw();
        VectorLine.canvas.renderMode = RenderMode.ScreenSpaceCamera;
        VectorLine.SetCanvasCamera(Camera.main);
        VectorLine.canvas.sortingLayerName = "Projectile";

        //Debug.Log(string.Format("{0}", VectorLine.canvas.sortingLayerName));

        // initiate two anchors
        for (int i = 0; i < NUM_ANCHORS; i++)
        {
            GameObject anchor = Instantiate <GameObject>(ProjectilePrefab);
            anchor.GetComponent <SpriteRenderer>().enabled    = false;
            anchor.GetComponent <Rigidbody2D>().simulated     = false;
            anchor.GetComponent <projectile_flying>().Shooter = gameObject;
            Anchors.Add(anchor);

            sqL0.Add(SquareMaxRopeLength);
        }
    }
Exemplo n.º 6
0
    void Start()
    {
        camera2d = GameObject.Find("Camera2d").GetComponent <Camera> ();
        VectorLine.SetCanvasCamera(camera2d);
        VectorLine.canvas3D.sortingLayerName = "World";

        gridLine = new VectorLine("Grid", new Vector2[0], null, 1.0f);
        drawLine = new VectorLine("DrawLine", new Vector3[0], null, 1.0f, isContinue? LineType.Continuous : LineType.Discrete, isContinue ? Joins.None : Joins.None);
        //drawLine.rectTransform.gameObject.AddComponent<Outline>();
        rulerLine      = new VectorLine("Ruler", new Vector3[0], null, 1.0f, LineType.Discrete);
        segmentOutline = new VectorLine("SegmentOutline", new Vector3[0], null, 1.0f, LineType.Discrete);
        segmentFill    = new WallFill(VectorLine.canvas3D, "SegmentFill");

        Vector2[] room = RoomQuad.GetVertex();
        //DrawWall(room);
        List <Wall2D> roomWalls = DrawHelper.ContinueToDiscrete(room);

        Home.Get().AddWallList(roomWalls);

//		VectorLine testLine = new VectorLine("test", new Vector3[] { Vector3.zero, new Vector3(1.0f, 0f, 0f), Vector3.one }, null, 2.0f, LineType.Continuous);
//		testLine.Draw3D();

        // Align 1-pixel lines on the pixel grid, so they don't potentially get messed up by anti-aliasing
        //gridLine.rectTransform.anchoredPosition = new Vector2 (.5f, .5f);
        gridLine.rectTransform.anchoredPosition = new Vector2(0f, 0f);
        //MakeGrid ();

        //SetScale(DrawHelper.unitPixels);
        DrawHelper.OnScaleChanged = MakeGrid2;
        DrawHelper.SetScale(camera2d, DrawHelper.unitPixels);

        mState = State2D.Idle;
    }
 // Token: 0x06000B32 RID: 2866 RVA: 0x00032DA8 File Offset: 0x000311A8
 private void Start()
 {
     Vector3[] array = new Vector3[this.numberOfStars];
     for (int i = 0; i < this.numberOfStars; i++)
     {
         array[i] = UnityEngine.Random.onUnitSphere * 100f;
     }
     float[] array2 = new float[this.numberOfStars];
     for (int j = 0; j < this.numberOfStars; j++)
     {
         array2[j] = UnityEngine.Random.Range(1.5f, 2.5f);
     }
     Color32[] array3 = new Color32[this.numberOfStars];
     for (int k = 0; k < this.numberOfStars; k++)
     {
         float num = UnityEngine.Random.value * 0.75f + 0.25f;
         array3[k] = new Color(num, num, num);
     }
     this.stars = new VectorLine("Stars", new List <Vector3>(array), 1f, LineType.Points);
     this.stars.SetColors(new List <Color32>(array3));
     this.stars.SetWidths(new List <float>(array2));
     this.stars.Draw();
     VectorLine.SetCanvasCamera(Camera.main);
     VectorLine.canvas.planeDistance = Camera.main.farClipPlane - 1f;
 }
Exemplo n.º 8
0
        // Unity Event Handlers

        protected void Awake()
        {
            // Attempt to reference active mouse orbit script
            m_mouseOrbitScript = GetComponent <MouseOrbit>();

            // Load previous settings from INI file
            LoadSettings();

            // Create line dictionary and data queue
            m_scales    = new ConcurrentDictionary <string, Scale>();
            m_dataLines = new ConcurrentDictionary <Guid, DataLine>();
            m_dataQueue = new ConcurrentQueue <IList <Measurement> >();

            // Initialize status rows and timer to hide status after a period of no updates
            m_statusText = new string[m_statusRows];

            for (int i = 0; i < m_statusRows; i++)
            {
                m_statusText[i] = "";
            }

            m_hideStatusTimer = new Timer
            {
                AutoReset = false,
                Interval  = StatusDisplayInterval
            };

            m_hideStatusTimer.Elapsed += HideStatusTimer_Elapsed;

            VectorLine.SetCanvasCamera(Camera.main);
            VectorLine.canvas.hideFlags = HideFlags.HideInHierarchy;
        }
Exemplo n.º 9
0
    // Token: 0x06000B6E RID: 2926 RVA: 0x00034AB8 File Offset: 0x00032EB8
    private IEnumerator Start()
    {
        base.GetComponent <Renderer>().enabled = false;
        this.rigidbodies = (UnityEngine.Object.FindObjectsOfType(typeof(Rigidbody)) as Rigidbody[]);
        VectorLine.canvas.planeDistance = 0.5f;
        yield return(null);

        VectorLine.SetCanvasCamera(this.vectorCam);
        yield break;
    }
Exemplo n.º 10
0
    IEnumerator Start()
    {
        GetComponent <Renderer>().enabled = false;
        rigidbodies = FindObjectsOfType(typeof(Rigidbody)) as Rigidbody[];
        VectorLine.canvas.planeDistance = .5f;

        // When using SetCanvasCamera, lines should be drawn first or else they don't appear correctly, so wait a frame for that to happen
        yield return(null);

        VectorLine.SetCanvasCamera(vectorCam);
    }
Exemplo n.º 11
0
    protected void Awake()
    {
        string defaultIniPath = Application.dataPath + "/" + IniFileName;
        string userIniPath    = Application.persistentDataPath + "/" + IniFileName;

        // Copy INI file with default settings to user INI file if one doesn't exist
        if (File.Exists(defaultIniPath) && !File.Exists(userIniPath))
        {
            File.Copy(defaultIniPath, userIniPath);
        }

        // Load settings from INI file
        IniFile iniFile = new IniFile(userIniPath);

        m_title                 = iniFile["Settings", "Title", m_title];
        m_connectionString      = iniFile["Settings", "ConnectionString", m_connectionString];
        m_filterExpression      = iniFile["Settings", "FilterExpression", m_filterExpression];
        m_lineWidth             = int.Parse(iniFile["Settings", "LineWidth", m_lineWidth.ToString()]);
        m_lineDepthOffset       = float.Parse(iniFile["Settings", "LineDepthOffset", m_lineDepthOffset.ToString()]);
        m_pointsInLine          = int.Parse(iniFile["Settings", "PointsInLine", m_pointsInLine.ToString()]);
        m_legendFormat          = iniFile["Settings", "LegendFormat", m_legendFormat];
        m_statusRows            = int.Parse(iniFile["Settings", "StatusRows", m_statusRows.ToString()]);
        m_statusDisplayInterval = double.Parse(iniFile["Settings", "StatusDisplayInterval", m_statusDisplayInterval.ToString()]);
        m_startTime             = iniFile["Settings", "StartTime", m_startTime];
        m_stopTime              = iniFile["Settings", "StopTime", m_stopTime];

        // Attempt to save INI file updates (e.g., to restore any missing settings)
        try
        {
            iniFile.Save();
        }
        catch (Exception ex)
        {
            Debug.Log("ERROR: " + ex.Message);
        }

        // Attempt to reference active mouse orbit script
        m_mouseOrbitScript = GetComponent <MouseOrbit>();

        // Create line dictionary and data queue
        m_scales      = new ConcurrentDictionary <string, Scale>();
        m_dataLines   = new ConcurrentDictionary <Guid, DataLine>();
        m_dataQueue   = new ConcurrentQueue <ICollection <IMeasurement> >();
        m_legendLines = new List <LegendLine>();

        // Initialize status rows and timer to hide status after a period of no updates
        m_statusText = new string[m_statusRows];

        for (int i = 0; i < m_statusRows; i++)
        {
            m_statusText[i] = "";
        }

        m_hideStatusTimer           = new System.Timers.Timer();
        m_hideStatusTimer.AutoReset = false;
        m_hideStatusTimer.Interval  = m_statusDisplayInterval;
        m_hideStatusTimer.Elapsed  += m_hideStatusTimer_Elapsed;

        // For mobile applications we use a larger GUI font size.
        // Other deployments might benefit from this as well - larger
        // size modes may work also but are not tested
        switch (Application.platform)
        {
        case RuntimePlatform.Android:
        case RuntimePlatform.IPhonePlayer:
            if (Screen.height <= 720)
            {
                m_guiSize = 2;          // 720P
            }
            else
            {
                m_guiSize = 3;          // 1080P or higher
            }
            break;
        }

        // Create a solid background for the control window
        m_controlWindowTexture = new Texture2D(1, 1);
        m_controlWindowTexture.SetPixel(0, 0, new Color32(10, 25, 70, 255));
        m_controlWindowTexture.Apply();

        VectorLine.SetCanvasCamera(Camera.main);
        VectorLine.canvas3D.hideFlags = HideFlags.HideInHierarchy;
    }