Ejemplo n.º 1
0
	public void SelectStar(StarController star)
	{
		if (_selectedStar == null) {
			Debug.Log("no previous star selected");
			_selectedStar = star;
			star.Select();
		} else {
			Debug.Log("star already selected");
			if (_selectedStar == star) {
				Debug.Log("selected same star");
				Debug.Log("Unselected star " + star.name);
				star.Unselect();
			} else if (_selectedStars.Contains(star)) {
				Debug.Log("already in connection");
				if (ConnectionExists(_selectedStar, star)) {
					DestroyStarConnection(_selectedStar, star);
					_selectedStar.Unconnect();
					star.Unconnect();
				} else {
					CreateStarConnection(_selectedStar, star);
					_selectedStar.Connect();
					star.Connect();
				}
			} else {
				Debug.Log("not already in connection");
				CreateStarConnection(_selectedStar, star);
				_selectedStars.Add(star);
				if (!_selectedStars.Contains(_selectedStar)) {
					_selectedStars.Add(_selectedStar);
				}
				_selectedStar.Connect();
				star.Connect();
			}
			_selectedStar = null;
		}
		if (CheckAnswer(hologramManager.currentLevel)) {
			lastCompletedLevel = hologramManager.currentLevel;
			StartCoroutine(TransitionToLevel(lastCompletedLevel + 1));
		}
	}