static void Main(string[] args) { //jackson was here ShapeManager sm = new ShapeManager(); string userinput = ""; Console.WriteLine("Press 1 to create a square"); Console.WriteLine("Press 2 to create a triangle"); Console.WriteLine("Press 9 to close loop"); while (userinput != "9") { if (userinput == "1") { sm.AddShape(new Square(7)); Console.WriteLine("Parameter:" + sm.GetFirstShape().GetPerimeter()); Console.WriteLine("Area:" + sm.GetFirstShape().GetArea()); userinput = ""; } else if (userinput == "2") { sm.AddShape(new Triangle(3, 5, 7)); Console.WriteLine("Parameter:" + sm.GetFirstShape().GetPerimeter()); Console.WriteLine("Area:" + sm.GetFirstShape().GetArea()); userinput = ""; } else { userinput = Console.ReadLine(); } } }
protected override void Initialize() { this.Window.Title = "spin boi"; GlobalWorld = Matrix.CreateTranslation(Vector3.Zero); GlobalView = Matrix.CreateLookAt(new Vector3(1, 1, 3), Vector3.Zero, Vector3.Up); GlobalProjection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45), _graphics.PreferredBackBufferWidth / _graphics.PreferredBackBufferHeight, 0.01f, 100f); _graphics.PreferMultiSampling = true; for (int row = 0; row < 10; row++) { for (int col = 0; col < 10; col++) { var cube = new Cube(GraphicsDevice, GlobalWorld, GlobalView, GlobalProjection); cube.World *= Matrix.CreateTranslation(new Vector3(row + 0.3f * row, col + 0.3f * col, 0) + new Vector3(-5, -5, -5)); ShapeManager.AddShape(cube); } } base.Initialize(); }
private void AddShape <T>(T shape) where T : Shape { shapeManager.AddShape(shape, mainPicBox); mainPicBox.Invalidate(); AddShapeToTreeView(shape); mainTreeView.ExpandAll(); }
void Update() { if (mFrameUpdated) { Debug.Log("updatefirst if"); mFrameUpdated = false; if (mImage == null) { InitARFrameBuffer(); } if (mARCamera.trackingState == ARTrackingState.ARTrackingStateNotAvailable) { // ARKit pose is not yet initialized return; } else if (!mARKitInit && LibPlacenote.Instance.Initialized()) { mARKitInit = true; Debug.Log("ARKit + placenote Initialized"); StartSavingMap(); } Matrix4x4 matrix = mSession.GetCameraPose(); Vector3 arkitPosition = PNUtility.MatrixOps.GetPosition(matrix); Quaternion arkitQuat = PNUtility.MatrixOps.GetRotation(matrix); LibPlacenote.Instance.SendARFrame(mImage, arkitPosition, arkitQuat, mARCamera.videoParams.screenOrientation); if (shouldRecordWaypoints) { Transform player = Camera.main.transform; //create waypoints if there are none around Collider[] hitColliders = Physics.OverlapSphere(player.position, 1f); int i = 0; while (i < hitColliders.Length) { if (hitColliders[i].CompareTag("waypoint")) { return; } i++; } Vector3 pos = player.position; Debug.Log(player.position); pos.y = -.5f; shapeManager.AddShape(pos, Quaternion.Euler(Vector3.zero));///////////adding shape Debug.Log("update last line"); } } }
void Start() { _shapeManager = FindObjectOfType <ShapeManager>(); if (initial == "no") { rb = GetComponent <Rigidbody2D>(); rb.drag = 2; int i = Random.Range(0, 4); float force = 3f; switch (i) { case 0: rb.AddForce(new Vector2(.1f, 0) * force, ForceMode2D.Impulse); break; case 1: rb.AddForce(new Vector2(.1f * -1, 0) * force, ForceMode2D.Impulse); break; case 2: rb.AddForce(new Vector2(0, 0.1f) * force, ForceMode2D.Impulse); break; case 3: rb.AddForce(new Vector2(0, .1f * -1) * force, ForceMode2D.Impulse); break; } StartCoroutine(ChangeDrag(.3f)); } else { Vector3 screenSize = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height - .5f, 0)); if (screenSize.y > screenSize.x) { transform.localScale = Vector3.one * screenSize.x * .35f; transform.position = Vector3.zero; } } _shapeManager.AddShape(gameObject); }