private void ButtonGenerate_OnClick(object sender, RoutedEventArgs e) { var polygon = PolygonGenerator.GeneratePolygon(0, Random.Next(390), 120, 120); _generated.Add(polygon); RedrawAll(); }
void Start() { StatusPlayer = Player.GetComponent("PlayerStats") as PlayerStats; Contororu = Player.GetComponent("PlayerControl") as PlayerControl; Physx = Player.GetComponent("PlayerPhysics3D") as PlayerPhysics3D; Porigon = terrain.GetComponent("PolygonGenerator") as PolygonGenerator; }
private float flDist = 0.3f; //floor distance // Use this for initialization void Start() { tScript = terrain.GetComponent("PolygonGenerator") as PolygonGenerator; rastro = new List <Vector2>(); playerTraces = new Vector2[20]; playerTraces[0] = new Vector2(0, 0); }
// Use this for initialization void Start() { info = new ProblemInfo(); info.startPointX = startPointX; info.startPointY = startPointY; info.endPointX = endPointX; info.endPointY = endPointY; info.g = g; info.startVelocity = startVelocity; info.numTrackPoints = numTrackPoints; if (selecao == 0) { selection = new RandomSelection(); } if (selecao == 1) { selection = new SelecaoTorneio(tamTorneio); } stats = new StatisticsLogger(statsFilename); drawer = new PolygonGenerator(); InitPopulation(); evaluatedIndividuals = 0; currentGeneration = 0; evolving = true; drawing = false; }
// Use this for initialization void Start() { rodo = ManagerGame.GetComponent("EditorSaveLoad") as EditorSaveLoad; ManagerEditor = ManagerGame.GetComponent("GameEditorManager") as GameEditorManager; porigon = terrain.GetComponent("PolygonGenerator") as PolygonGenerator; //OpenLoaded(); }
// Use this for initialization void Start() { tScript = terrain.GetComponent("PolygonGenerator") as PolygonGenerator; PlayerMovement = GetComponent <PlayerControl>(); PlayerPhysics = GetComponent <PlayerPhysics3D>(); PlayerStats = GetComponent <PlayerStats>(); AuxSizeY = 1.5f - transform.localScale.y; // AuxSizeX = (0.5f - transform.localScale.x)/0.25f; PlayerMovement.isDigging = 0; }
public override void OnInspectorGUI() { base.OnInspectorGUI(); script = target as PolygonGenerator; if (GUILayout.Button("Generate Mesh")) { script.GenerateMesh(); } }
private static List <Line> CreatePoly(IMinecraftCommandService commandService, string[] commandArgs, Position position, List <SavedPosition> savedPositions) { IPolygonOptions poly = new Options { Fill = false }; var location = position; commandArgs = ProcessFillArgument(commandArgs, (Options)poly); if (commandArgs.Count() > 3) { poly.StartingAngle = commandArgs[1].ToInt(); poly.Sides = commandArgs[2].ToInt(); poly.Steps = commandArgs[3].ToInt(); } commandArgs = commandArgs.Skip(4).ToArray(); switch (commandArgs.Length) { case 2: // radius block @ current position & height=1 poly.Block = commandArgs[1]; poly.Radius = commandArgs[0].ToInt(); poly.Height = 1; break; case 3: // radius height(Y) block @ current position poly.Block = commandArgs[2]; poly.Radius = commandArgs[0].ToInt(); poly.Height = commandArgs[1].ToInt(); break; case 4: // radius height(Y) block savedposition case 6: // radius height(Y) block x y z poly.Radius = commandArgs[0].ToInt(); poly.Height = commandArgs[1].ToInt(); poly.Block = commandArgs[2]; location = location.GetAbsolutePosition(commandArgs.Skip(3).Take(3), savedPositions); break; default: commandService.Status("\nCREATE POLY\n" + "create poly [fill] startingAngle sides steps radius block\n" + "create poly [fill] startingAngle sides steps radius height(Y) block - current position\n" + "create poly [fill] startingAngle sides steps radius height(Y) block [named position]\n" + "create poly [fill] startingAngle sides steps radius height(Y) block x y z"); return(new List <Line>()); } poly.Start = location.ToPoint(); IGenerator generator = new PolygonGenerator(); return(generator.Run((Options)poly)); }
// Use this for initialization void Start() { tscript = Terrain.GetComponent("PolygonGenerator") as PolygonGenerator; ManagerGame = gameManager.GetComponent("GameManager") as GameManager; StatusPlayer = Player.GetComponent("PlayerStats") as PlayerStats; collider = GetComponent <BoxCollider>(); s = collider.size; c = collider.center; HP = baseHP; }
public void SetDifficulty() { terrain = (PolygonGenerator) GameObject.Find("GameController").GetComponent<GameFlowController>().currentApocalypse.GetComponent<PolygonGenerator>(); currentApocalypse = terrain.apocalypseType; Debug.Log("Current Apocalypse: " + currentApocalypse.ToString()); difficulty = GameObject.Find("EnemySpawner").GetComponent<EnemySpawn>().difficulty; //Debug.Log ("Difficulty: " + difficulty.ToString()); maxHazards = difficulty * 5 + 5; hazardSpawnRate = 300 - (30 * difficulty); //Debug.Log("Spawn Rate: " + hazardSpawnRate.ToString()); }
private static void AddHandles(GameObject parent, PolygonGenerator pg) { pg.north = NameInstantiateAndParentHandle(parent.transform, "N"); pg.northWest = NameInstantiateAndParentHandle(parent.transform, "NW"); pg.northEast = NameInstantiateAndParentHandle(parent.transform, "NE"); pg.east = NameInstantiateAndParentHandle(parent.transform, "E"); pg.southEast = NameInstantiateAndParentHandle(parent.transform, "SE"); pg.south = NameInstantiateAndParentHandle(parent.transform, "S"); pg.southWest = NameInstantiateAndParentHandle(parent.transform, "SW"); pg.west = NameInstantiateAndParentHandle(parent.transform, "W"); }
// Use this for initialization void Start() { rend = GetComponent <Renderer>(); color = rend.material.color; // color.a = 0; // rend.material.color = color; // gameObject.renderer.enabled = false; collider = gameObject.GetComponent <BoxCollider>(); tScript = Terrain.GetComponent("PolygonGenerator") as PolygonGenerator; }
// Use this for initialization void Start() { tScript = Terrain.GetComponent("PolygonGenerator") as PolygonGenerator; ManagerGame = gameManager.GetComponent("GameManager") as GameManager; collider = GetComponent <BoxCollider>(); s = collider.size; c = collider.center; timar = preTimar; }
public GeneratorInfo(PolygonManagementViewModel parent, string friendlyName, PolygonGenerator generator) { FriendlyName = friendlyName; Generator = generator; Parent = parent; Parent.PropertyChanged += (_, ea) => { if (ea.PropertyName == nameof(PolygonManagementViewModel.SelectedPolygonGenerator)) { RaisePropertyChanged(nameof(Selected)); } }; }
// Use this for initialization void Start() { DeltaPosition = new Vector2(0, 0); PlayerPhysics3D = GetComponent <PlayerPhysics3D>(); StatusPlayer = GetComponent <PlayerStats>(); Paragon = terrain.GetComponent("PolygonGenerator") as PolygonGenerator; animator = GetComponent <Animator>(); DiggingMechanics = GetComponent <DiggingMechanics>(); movementLocked = false; PosState = 0; rastro = new List <Vector2>(); }
/// <summary> /// Will do a warmup run to let the JVM optimize the triangulation code -- or would if this were Java --MM /// </summary> public static void Warmup() { #if false /* * After a method is run 10000 times, the Hotspot compiler will compile * it into native code. Periodically, the Hotspot compiler may recompile * the method. After an unspecified amount of time, then the compilation * system should become quiet. */ Polygon poly = PolygonGenerator.RandomCircleSweep2(50, 50000); TriangulationProcess process = new TriangulationProcess(); process.triangulate(poly); #endif }
private static List <Line> CreateTriangle(IMinecraftCommandService commandService, string[] commandArgs, Position position, List <SavedPosition> savedPositions) { IPolygonOptions triangle = new Options { Fill = false }; var location = position; commandArgs = ProcessFillArgument(commandArgs, (Options)triangle); switch (commandArgs.Length) { case 3: // radius block @ current position & height=1 triangle.Radius = commandArgs[1].ToInt() / 2; triangle.Block = commandArgs[2]; triangle.Height = 1; break; case 4: // radius height(Y) block @ current position triangle.Radius = commandArgs[1].ToInt() / 2; triangle.Height = commandArgs[2].ToInt(); triangle.Block = commandArgs[3]; break; case 5: // radius height(Y) block savedposition case 7: // radius height(Y) block x y z triangle.Radius = commandArgs[1].ToInt() / 2; triangle.Height = commandArgs[2].ToInt(); triangle.Block = commandArgs[3]; location = location.GetAbsolutePosition(commandArgs.Skip(4).Take(3), savedPositions); break; default: commandService.Status("\nCREATE TRIANGLE\n" + "create triangle [fill] radius block\n" + "create triangle [fill] radius height(Y) block - current position\n" + "create triangle [fill] radius height(Y) block [named position]\n" + "create triangle [fill] radius height(Y) block x y z"); return(new List <Line>()); } triangle.Start = location.ToPoint(); triangle.Sides = 3; triangle.Steps = 3; triangle.StartingAngle = 0; IGenerator generator = new PolygonGenerator(); return(generator.Run((Options)triangle)); }
// Use this for initialization void Start() { waitFrame = 0; tScript = terrain.GetComponent("PolygonGenerator") as PolygonGenerator; PlayerMovement = Player.GetComponent("PlayerControl") as PlayerControl; StatusPlayer = Player.GetComponent("PlayerStats") as PlayerStats; animata = this.GetComponent <Animator>(); //animata = this.GetComponent("Animator") as Animator; rastro = new List <Vector2>(); // TracingCurves = PlayerMovement.Final; TracePlayer(4); HP = baseHP; attackDelay = gameObject.AddComponent <Timer>(); turnDelay = gameObject.AddComponent <Timer>(); attackDelay.SetValues(0.5f, 1); }
private void FindIntersectionPoint(Vector3 lineStart, Vector3 lineEnd) { PolygonGenerator pg = lineSource.GetComponentInChildren <PolygonGenerator>(); Vector3[] verts = pg.GenerateWorldVertices(); for (int i = 0; i < verts.Length; i++) { Vector3 polygonSideStart = verts[i]; Vector3 polygonSideEnd; polygonSideEnd = GetPolygonSideEnd(verts, i); LineIntersectionManager.IntersectionCheck ic = LineIntersectionManager.DoLinesIntersect(lineStart, lineEnd, polygonSideStart, polygonSideEnd); if (ic.didIntersect) { intersectionMarker.SetActive(true); intersectionMarker.transform.position = ic.intersectionPoint; } }//end for }
public void InstantiatePolygonFromVertices(List <Vector3> polygonVertices) { Dictionary <int, int> neighbouringVertexMapping; GameObject polygon = PolygonGenerator.GeneratePolygonFromVertices(polygonVertices, 0.1f, polygonMaterial, out neighbouringVertexMapping); polygon.name = "polygon " + GameObjectsInScene.Count; Vector2d polygonCoordinates = setPolygonParentToMapTile(polygon); UserGeneratedPolygon script = polygon.AddComponent <UserGeneratedPolygon>(); script.neighbouringVertexMapping = neighbouringVertexMapping; CoordinateBoundObject polygonWithCoordinates = new CoordinateBoundObject(); polygonWithCoordinates.latitude = (float)polygonCoordinates.x; polygonWithCoordinates.longitude = (float)polygonCoordinates.y; polygonWithCoordinates.gameObject = polygon; GameObjectsInScene[polygon.name] = polygonWithCoordinates; // add to the dropdown DropDownPolygons.Instance.AddItemToDropdown(polygon.name); }
// Use this for initialization void Start() { info = new ProblemInfo(); info.startPointX = startPointX; info.startPointY = startPointY; info.endPointX = endPointX; info.endPointY = endPointY; info.g = g; info.startVelocity = startVelocity; info.numTrackPoints = numTrackPoints; info.numberOfCrossoverPoints = numberOfCrossoverPoints; tournamentSelection = new TournamentSelection(); //change accordingly stats = new StatisticsLogger(statsFilename); drawer = new PolygonGenerator(); InitPopulation(); evaluatedIndividuals = 0; currentGeneration = 0; evolving = true; drawing = false; }
public PolygonIndividual() { Polygon = PolygonGenerator.RandomPolygon(Utils.PolygonSettingsAccessor.PolygonsVertices); CommonInitialization(); }
void Start() { tScript = terrain.GetComponent("PolygonGenerator") as PolygonGenerator; }
void Awake() { porigon = this; print("porigonized"); }
protected override void OnEnable() { polyGenerator = (PolygonGenerator)target; InitializeVariables(); }
private static void SetupObject(string name, Rigidbody parentRB, GameObject figure, PolygonGenerator pg) { figure.tag = "Polygon"; figure.transform.parent = parentRB.transform; Rigidbody rb = figure.AddComponent <Rigidbody>(); rb.useGravity = false; rb.isKinematic = true; pg.color = Color.red; pg.borderColor = Color.black; pg.radius = 2f; AddHandles(figure, pg); GameObject inputField = GameObject.Instantiate(GameManager.S.inputFieldPrefab, Vector3.zero, Quaternion.identity); inputField.name = name + "_text"; inputField.transform.parent = GameManager.S.inputCanvas.transform; RectTransform rTransform = inputField.GetComponent <RectTransform>(); rTransform.localScale = Vector3.one; pg.inputField = inputField; pg.Initialize(); }
// Update is called once per frame void Update() { if (currTime > difficultyTimer){ followingTarget = false; boolZoom = 1; prevPosition = target.position - followDistance; currTime = 0; } if (Input.GetKey (KeyCode.C)) { followingTarget = false; boolZoom = 1; prevPosition = target.position - followDistance; } else { //followingTarget = true; } if (boolZoom == 0) { transform.position = target.position - followDistance; transform.LookAt (target, new Vector3(0, 0, -1)); } else {/* //Debug.Log ("currently free roaming"); if (Input.mousePosition.x > Screen.width - screenBufferSize) { transform.position += Quaternion.Euler(0, 0, -45) * (velocity * new Vector3(1, 0, 0)); //Debug.Log ("Mouse Right"); } if (Input.mousePosition.x < screenBufferSize) { transform.position += Quaternion.Euler(0, 0, -45) * (velocity * new Vector3(-1, 0, 0)); //Debug.Log ("Mouse Left"); } if (Input.mousePosition.y > Screen.height - screenBufferSize) { transform.position += Quaternion.Euler(0, 0, -45) * (velocity * new Vector3(0, 1, 0)); //Debug.Log ("Mouse Up"); } if (Input.mousePosition.y < screenBufferSize) { transform.position += Quaternion.Euler(0, 0, -45) * (velocity * new Vector3(0, -1, 0)); //Debug.Log ("Mouse Down"); }*/ Time.timeScale = 0.0f; if(boolZoom == 1){ Vector3 dir = (transform.position - target.position).normalized; dir.x = 0; dir.y = 0.05f; if(playAudio){ audio.clip = rumble; audio.PlayOneShot (rumble); playAudio = false; } if(Vector3.Distance (transform.position, target.position) < 20){ transform.Translate (dir * .1f); } else boolZoom = 2; } else if(boolZoom == 2){ Camera.main.SendMessage ("fadeOut"); timer++; if(timer > 60) boolZoom = 3; } else if(boolZoom == 3){ //diff increase pg = GameObject.Find ("GameController").GetComponent<GameFlowController>().currentApocalypse.GetComponent<PolygonGenerator>(); pg.IncreaseDifficulty (); Debug.Log ("New Difficulty: " + pg.difficulty); boolZoom = 4; } else if(boolZoom == 4){ //screen shake? //sound effect Camera.main.SendMessage("fadeIn"); timer++; if(timer > 120) boolZoom = 5; } else if(boolZoom == 5){ Vector3 dir = -(transform.position - prevPosition).normalized; if(Vector3.Distance (transform.position, prevPosition) > 0.2f){ //Debug.Log ("boop"); transform.Translate (dir * .1f);// * Time.deltaTime); } else { timer = 0; boolZoom = 0; //Debug.Log ("Liiiive!"); Time.timeScale = 1.0f; playAudio = true; } } //Debug.Log("beep"); } }
private void Interact(Vector3 m3) { if (Input.GetMouseButton(0)) { if (!interaction) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { //lineMarkerEnd.SetActive(false); //intersectionMarker.SetActive(false); targetTransform = hit.transform.parent; if (targetTransform != null) //Because mouse can hover the polygon parent as well. { polyGenerator = targetTransform.GetComponentInChildren <PolygonGenerator>(); AssignInteractionType(hit); deltaFromMousePos = (targetTransform.position - m3); interaction = true; } }/* else * { * lineMarkerEnd.SetActive(true); * lineMarkerEnd.transform.position = m3; * * * Vector3[] lineVerts = { intersectionMarker.transform.position, m3 }; * //lineRenderer.SetPositions(lineVerts); * if (lineRenderer == null) * { * FindIntersectionPoint(lineSource.transform.position, m3); * lineRenderer = PolygonUtilities.DrawLine(line, lineVerts, Color.gray, .02f, "Sprites/Default"); * lineCollider = PolygonUtilities.AddLineCollider(line); * } * * }*/ } if (targetTransform != null) { if (!mouseLastPosition.Equals(Vector3.zero)) { switch (interactionType) { case InteractionType.DRAG: targetTransform.position = deltaFromMousePos + m3; break; case InteractionType.SCALENW: ScaleNW(m3); break; case InteractionType.SCALEN: ScaleN(m3); break; case InteractionType.SCALENE: ScaleNE(m3); break; case InteractionType.SCALEE: ScaleE(m3); break; case InteractionType.SCALESE: ScaleSE(m3); break; case InteractionType.SCALES: ScaleS(m3); break; case InteractionType.SCALESW: ScaleSW(m3); break; case InteractionType.SCALEW: ScaleW(m3); break; } } mouseLastPosition = m3; } } else { ResetInteractionState(); /*if (lineRenderer != null) * { * PolygonUtilities.SetSizeAndOrient(lineSource.transform, lineRenderer, lineCollider); * }*/ } }
// Use this for initialization void Start() { tScript = terrain.GetComponent("PolygonGenerator") as PolygonGenerator; tScript.update = true; }
// Use this for initialization void Start() { tScript = terrain.GetComponent ("PolygonGenerator") as PolygonGenerator; }
// Use this for initialization void Start() { tScript = terrain.GetComponent <PolygonGenerator>(); }
void Start() { Porigon = terrain.GetComponent("PolygonGenerator") as PolygonGenerator; RodoSucripto = LoadMenu.GetComponent("EditorLoadScript") as EditorLoadScript; }
// Use this for initialization void Start() { tscript = Terrain.GetComponent("PolygonGenerator") as PolygonGenerator; poola = GetComponent <NewObjectPoolerScript>(); }
void Start(){ tScript = GameObject.FindObjectOfType<PolygonGenerator>(); }