/// <summary> /// Initialize game controller. /// </summary> void Init() { foreach (GameObject go in GameObject.FindGameObjectsWithTag(Tags.mapLayer)) { _maps.Add(go.GetComponent <MapLayerControl> ()); } _maps.Sort(); _selectMapIndex = 0; foreach (GameObject go in GameObject.FindGameObjectsWithTag(Tags.levelGate)) { _levels.Add(go.GetComponent <LevelGateControl> ()); } _levels.Sort(); for (int i = 0; i < _levels.Count; i++) { _levels [i].SetLevelIndex(i); } _selectLevel = null; //level No.1 start unlocked _levels [0].GetComponent <LevelInfo> ().Unlock(); _lastUnlockIndex = 0; foreach (GameObject go in GameObject.FindGameObjectsWithTag(Tags.pathPoint)) { _pathPoints.Add(go.GetComponent <PathPointControl> ()); } _pathPoints.Sort(); for (int i = 0; i < _pathPoints.Count - 1; i++) { if (_pathPoints [i]._pointPostfix == 1 && _pathPoints [i]._levelPostfix > 0) { _levels [_pathPoints [i]._levelPostfix - 1]._nextPathPoint = _pathPoints [i]; } if (_pathPoints [i]._pointPostfix == _pathPoints [i + 1]._pointPostfix - 1) { _pathPoints [i]._nextPathPoint = _pathPoints [i + 1]; } else { if (_pathPoints [i]._levelPostfix < _levels.Count) { _pathPoints [i]._nextLevelGate = _levels [_pathPoints [i]._levelPostfix]; } } } if (_pathPoints [_pathPoints.Count - 1]._levelPostfix < _levels.Count) { _pathPoints [_pathPoints.Count - 1]._nextLevelGate = _levels [_pathPoints [_pathPoints.Count - 1]._levelPostfix]; } _battleController.gameObject.SetActive(false); }
public void LevelButtonClick(LevelGateControl level) { if (level != _selectLevel) { _SwordForSelection.Show(level.transform.position); _selectLevel = level; } else { BattleStart(level.GetComponent <LevelInfo> ()); } }
public void LevelButtonClick(LevelGateControl level) { if (level != _selectLevel) { if (_selectLevel != null && _selectLevel.GetMapLayer() == _maps [_selectMapIndex]) { _selectLevel = level; _SwordForSelection.Disappear(ShowSword); } else { _selectLevel = level; ShowSword(); } } else { BattleStart(level.GetComponent <LevelInfo> ()); } }
void Awake() { _gateControl = GetComponent <LevelGateControl> (); }
// Use this for initialization void Awake() { _childStar = GetComponentInChildren <StarControl> (); _level = GetComponentInParent <LevelGateControl> (); }