void OnEnable() { if (SceneManager.GetActiveScene().buildIndex == 0) { gm = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster>(); levelBlocksScroller = GameObject.FindGameObjectWithTag("LevelBlocksScroller").transform; startingPos = levelBlocksScroller.position; targetXPos = startingPos.x; oldXPos = startingPos.x; for (int i = 0; i < transform.childCount; i++) { if (transform.GetChild(i).name == "BestTimeLittleGirl") { bestTimeTextLittleGirl = transform.GetChild(i).GetComponentInChildren <Text>(); } if (transform.GetChild(i).name == "BestTimeDiety") { bestTimeTextDiety = transform.GetChild(i).GetComponentInChildren <Text>(); } if (transform.GetChild(i).name == "LevelScroller") { levelScroller = transform.GetChild(i).GetComponentInChildren <LevelScroller>(); } } } }
private void SetupLevelController(GameConfig config, LevelConfig levelConfig) { levelScroller?.Destroy(); var container = transform; var pool = new LevelObjectsPool(levelConfig, 2, container); var generator = new ChunkGenerator(levelConfig, pool, config.chunkGraphLength, config.chunkGraphWidth); levelScroller = new LevelScroller(generator, container); }
// Use this for initialization void Start() { //MAX_PLAYERS = GameObject.FindGameObjectWithTag("GlobalConstant").GetComponent<ConstantData>().MAX_PLAYERS; //players = new int[MAX_PLAYERS]; //for (int i = 0; i < MAX_PLAYERS; ++i) //{ // players[i] = GameObject.FindGameObjectWithTag("GlobalConstant").GetComponent<ConstantData>().playerController[i]; //} scrollerScript = GameObject.Find ("Scroller").GetComponent<LevelScroller>(); startTime = totalTime; counterText = transform.Find ("Clock").GetComponent<Text> (); minutes = (int)Mathf.Floor(totalTime / 60f); seconds = totalTime % 60f; PutTimeToScreen (); }
// This function is called when the script is started private void Awake() { _targetInstance = (LevelScroller)target; _targetInstance.BossLevelReady += () => Debug.Log("Boss level ready"); }