static void Main(string[] args) { //Console.SetWindowSize(40, 16); //for (int x = 0; x < 5; x++) //{ // for (int y = 0; y < 10; y++) // { // var p3 = new Point(x, y, '#'); // p3.Draw(); // } //} //List<Point> pList = new List<Point>(); //pList.Add(new Point(10, 10, 'c')); //pList.Add(new Point(11, 10, 'c')); //pList.Add(new Point(3, 10, 'c')); //pList.Add(new Point(10, 2, 'c')); //pList.Add(new Point(7, 10, 'c')); //foreach (var p in pList) //{ // p.Draw(); //} HorizontalLine hLine = new HorizontalLine(0, 0, 36, '#'); HorizontalLine hLine2 = new HorizontalLine(0, 20, 36, '#'); hLine.Draw(); hLine2.Draw(); VerticalLine vLine = new VerticalLine(0, 0, 21, '#'); VerticalLine vLine2 = new VerticalLine(36, 0, 21, '#'); vLine.Draw(); vLine2.Draw(); Random rand = new Random(); Point p = new Point(5, rand.Next(2, 10), '*'); p.Draw(); while (true) { Thread.Sleep(300); p.Move(Direction.Down); } Console.ReadLine(); }
static void Main(string[] args) { HorizontalLine h1 = new HorizontalLine(1, 25, 1, '#'); h1.Draw(); HorizontalLine h2 = new HorizontalLine(1, 25, 30, '#'); h2.Draw(); VerticalLine v1 = new VerticalLine(1, 30, 1, '#'); v1.Draw(); VerticalLine v2 = new VerticalLine(1, 30, 25, '#'); v2.Draw(); Console.ReadKey(); }
public override void Start() { var p1 = new Point(0, 0); var p2 = new Point(p1); p1.Draw(); Console.WriteLine(); Console.WriteLine("Point p1 = new Point(0,0);"); Console.WriteLine("Point p2 = new Point(p1);"); Console.WriteLine("IsHit(p1,p2): {0}", Point.IsHit(p1, p2)); Console.WriteLine("p1.IsHit(p2): {0}", p1.IsHit(p2)); Console.WriteLine("p2.IsHit(p1): {0}", p2.IsHit(p1)); Console.WriteLine("Equals(p1,p2): {0}", Equals(p1, p2)); p2.Y = p1.Y = 10; p2.X = 1; p2.Char = '#'; Console.WriteLine("p2.Y = p1.Y = 10;"); Console.WriteLine("p2.X = 1;"); Console.WriteLine("p2.Char = '#';"); p1.Draw(); p2.Draw(); Console.WriteLine(); Console.WriteLine("IsHit(p1,p2): {0}", Point.IsHit(p1, p2)); Console.WriteLine("p1.IsHit(p2): {0}", p1.IsHit(p2)); Console.WriteLine("p2.IsHit(p1): {0}", p2.IsHit(p1)); Console.WriteLine(); var f1 = new VerticalLine(20, 24, 2, '*'); var f2 = new HorizontalLine(0, 4, 22, '*'); Console.SetCursorPosition(0, 25); Console.WriteLine("Figure f1 = new VerticalLine(20, 24, 2, '*');"); Console.WriteLine("Figure f2 = new HorizontalLine(0, 4, 22, '*');"); Console.WriteLine("IsHit(f1, f2): {0}", Figure.IsHit(f1, f2)); Console.WriteLine("f1.IsHit(f2): {0}", f1.IsHit(f2)); Console.WriteLine("f2.IsHit(f1): {0}", f2.IsHit(f1)); f1.Draw(); f2.Draw(); Console.ReadKey(); }
void OnGUI() { if (SceneView.lastActiveSceneView == null) { return; } // Camera data transfer controls EditorGUILayout.BeginHorizontal(); { GUI.enabled = false; EditorGUILayout.ObjectField(SceneView.lastActiveSceneView.camera, typeof(Camera), true, GUILayout.MaxWidth(150)); GUI.enabled = (targetCam != null) && !syncCam; if (GUILayout.Button("<-")) { controledProperties.Copy(targetCam); SetSceneCamTransformData(); } GUI.enabled = targetCam != null; syncCam = EditorGUILayout.Toggle(syncCam, "IN LockButton", GUILayout.MaxWidth(15)); GUI.enabled = (targetCam != null) && !syncCam; if (GUILayout.Button("->")) { controledProperties.Paste(targetCam, _syncFOV); } GUI.enabled = true; EditorGUIUtility.labelWidth = 80; targetCam = (Camera)EditorGUILayout.ObjectField(targetCam, typeof(Camera), true, GUILayout.MaxWidth(150)); EditorGUIUtility.labelWidth = -1; } EditorGUILayout.EndHorizontal(); if (GUI.changed) { SceneView.lastActiveSceneView.Repaint(); } // Scene camera Inspector HorizontalLine.Draw(); EditorGUILayout.LabelField(EditorGUIUtility.ObjectContent(SceneView.lastActiveSceneView.camera, typeof(Camera))); EditorGUI.indentLevel = EditorGUI.indentLevel + 1; if (showSceneCamData) //TODO foldout arrow { GUI.changed = false; EditorGUIUtility.wideMode = true; DrawTransformData(); GUILayout.BeginHorizontal(); controledProperties.fov = EditorGUILayout.Slider(new GUIContent("Field Of View"), controledProperties.fov, 0.1f, 200f, GUILayout.ExpandWidth(true)); if (GUILayout.Button("Reset", GUILayout.MaxWidth(50f))) { resetFovOnce = true; } _syncFOV = EditorGUILayout.Toggle("Sync FOV", _syncFOV); GUILayout.EndHorizontal(); if (GUI.changed) { SetSceneCamTransformData(); SceneView.lastActiveSceneView.Repaint(); } } }