private void mockSpawnStars() { int index = 0; string starSeedId = null; for (; index < 42; index++) { StarInfo starInfo = new StarInfo(); starInfo.randomizeInfo(); spawnStar(starInfo); // set seed star as visited if (starSeedId == null) { starSeedId = starInfo.starId; NStar starSeed = null; if (starMap.TryGetValue(starSeedId, out starSeed)) { starSeed.setVisited(); } } } }
private void updateStarMap() { Vector2 touchPoint = new Vector2(Input.mousePosition.x, Input.mousePosition.y); Vector3 worldPoint = Camera.main.ScreenToWorldPoint(touchPoint); bool overlaped = false; foreach (NStar star in starMap.Values) { if (star.isOverlapPoint(worldPoint) && !overlaped) { overlaped = true; selectedStar = star; selectedStar.setSelected(); } else { star.clearSelected(); } star.clearHighlightFromParentBranch(); } if (selectedStar != null) { selectedStar.highlightChildBranch(); } }
public void join(NStar parent, StarInfo starInfo) { this.starInfo = starInfo; starPositionInBubble = Random.Range(0, 360); // one time setup of parent if (parentStar == null && parent != null) { parentStar = parent; } if (parentStar != null) { parentStar.clearSelected(); parentStar.setChild(this); } }
private void spawnStar(StarInfo starInfo) { currentStar = Instantiate(bubble, transform).GetComponent <NStar>(); randomScale(currentStar.transform); starMap.Add(starInfo.starId, currentStar.GetComponent <NStar>()); NStar currentSelectedStar = getSelected(); Vector3 currentStarPosition = new Vector3(); if (currentSelectedStar != null) { currentStarPosition = currentSelectedStar.transform.position; } currentStar.GetComponent <NStar>().join(getSelected(), starInfo); currentStar.transform.position = getNextStarCoordinates(currentStarPosition); parentStar = currentStar; stellarSystemPreparedToCreate = false; }
private void setCurrentStar(string starId) { NStar starToBePromoted = null; if (starMap.TryGetValue(starId, out starToBePromoted)) { foreach (NStar star in starMap.Values) { if (star.isCurrent()) { star.clearCurrent(); } } starToBePromoted.setCurrent(); } else { Debug.LogError("No star is found with id: " + starId); } }
public void setChild(NStar child) { childStars.Add(child); }