// Update is called once per frame void Update() { if (EnvironmentModel.Instance.CurrentLevel != this.currentLevel) { this.currentLevel = EnvironmentModel.Instance.CurrentLevel; Star.transform.position = this.CreateNewStar(7, 10, 7) + EnvironmentModel.Instance.Offset; Player.transform.position = new Vector3(0, 100, 0); EnvironmentModel.Instance.RemoveAll(); EnvironmentModel.Instance.Generate(System.Math.Min(EnvironmentModel.Instance.CurrentLevel * 25, 500), 7, 10, 7); PickUpGenerator.Clear(); PickUpGenerator.GenerateHearts(5, 7, 1, 7); } if (Input.GetKeyDown(KeyCode.F1)) { this.Start(); this.LevelUpdateUI.enabled = false; this.StopWatchText.enabled = true; } if (Models.LevelStopwatch.Instance.ElapsedTimeSpan.CompareTo(Constants.MaximumTime) > 0) { this.StopWatchText.enabled = false; this.LevelUpdateUI.enabled = true; Models.LevelStopwatch.Instance.Stop(); Models.LevelStopwatch.Instance.ElapsedTimeSpan = new System.TimeSpan(); } }
void Start() { //platformWidth = thePlatform.GetComponent<BoxCollider2D>().size.x; platformWidths = new float[theObjectPools.Length]; for (int i = 0; i < theObjectPools.Length; i++) { platformWidths[i] = theObjectPools[i].pooledObject.GetComponent <BoxCollider2D>().size.x; } minHeight = transform.position.y; maxHeight = maxHeightPoint.position.y; thePickUpGenerator = FindObjectOfType <PickUpGenerator>(); }
// Use this for initialization void Start() { FloorInitializer.CreateFloor(); EnvironmentModel.Instance.RemoveAll(); PickUpGenerator.Clear(); EnvironmentModel.Instance.Offset = new Vector3(0, 0.5f, 0); //this.transform.position; EnvironmentModel.Instance.Generate(25, 5, 5, 5); Player.transform.position = new Vector3(0, 100, 0); Star.transform.position = this.CreateNewStar(5, 5, 5) + EnvironmentModel.Instance.Offset; PickUpGenerator.GenerateHearts(5, 7, 3, 7); LevelStopwatch.Instance.Reset(); LevelStopwatch.Instance.Start(); LevelStopwatch.Instance.ElapsedTimeSpan = new System.TimeSpan(); this.currentLevel = 0; EnvironmentModel.Instance.CurrentLevel = 0; Constants.DestroyedBlocksCounter = 0; Constants.CreatedBlocksCounter = 0; if (this.first) { EnvironmentModel.Instance.DestroyGameObjectEvent += (GameObject obj) => DestroyImmediate(obj); first = false; } }
private void Start() { pickUpGenerator = FindObjectOfType <PickUpGenerator>(); timeBar = FindObjectOfType <TimeBar>(); StartCoroutine(SelfDestroy()); }
private void Awake() { PickUpGenerator.instance = this; }