// 테스트용 커스텀 경첩 생성 IEnumerator CreateCustomHinge(int cnt) { currentGeneration = new Generation { generationLevel = 0, movementInfos = new List <int[]>() }; int[] movementInfo = { 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1 }; hinges = new List <GameObject>(); for (int i = 0; i < cnt; i++) { currentGeneration.movementInfos.Add(movementInfo); hinges.Add(Instantiate(hinge, new Vector3(i * -30, 0, 0), Quaternion.identity)); HingeControl hingeControl = hinges[i].GetComponent <HingeControl>(); hingeControl.movementInfo = new int[MOVEMENT_INFO_LENGTH]; move += new Move(hingeControl.Move); for (int j = 0; j < MOVEMENT_INFO_LENGTH; j++) { hingeControl.movementInfo[j] = currentGeneration.movementInfos[i][j]; } } yield return(new WaitForSeconds(3)); StartMove(); }
// 현재 세대 경첩들을 세팅한다 public void SettingCurrentGeneration() { generationLevelText.text = currentGeneration.generationLevel + "세대"; hinges = new List <GameObject>(); for (int i = 0; i < NUMBER_OF_GENERATION; i++) { hinges.Add(Instantiate(hinge, new Vector3(i * -30, 0, 0), Quaternion.identity)); HingeControl hingeControl = hinges[i].GetComponent <HingeControl>(); hingeControl.movementInfo = new int[MOVEMENT_INFO_LENGTH]; if (i == 0) { move = new Move(hingeControl.Move); } else { move += new Move(hingeControl.Move); } for (int j = 0; j < MOVEMENT_INFO_LENGTH; j++) { hingeControl.movementInfo[j] = currentGeneration.movementInfos[i][j]; } } }
void SetSplineControllerSplines(HingeControl hingeControl, Genotype.EGenotypeIndex index) { var splines = genotype.GetSplineController(index); float[] initializeSplineCps = splines.Take(splines.Length / 2).ToArray(); float[] cyclicSplineCps = splines.Skip(splines.Length / 2).ToArray(); hingeControl.SetSplineControllers(new HermiteSpline(initializeSplineCps), new HermiteSpline(cyclicSplineCps)); }