// Use this for initialization void Start() { //reference to the controller in gathering mode generationScript = GlobalVars.GATHERING_CONTROLLER; //determines which lane the element is in lane = GlobalVars.GATHERING_CONTROLLER.whichLane(transform.position.x); }
public override void OnInspectorGUI() { GenerationScript t = target as GenerationScript; DrawDefaultInspector(); if (GUILayout.Button("Regen")) { t.RegenerateMap(); } }
void Start() { //sets the starting score an element pointsForElement = basePointsForElement; //finds the controller and script references controller = GameObject.FindGameObjectWithTag("Controller"); // Assigning the generation script. generationScript = controller.GetComponent <GenerationScript>(); }
void Update() { //counts the amount of time elapsed ---- isCountingDown boolean is a check for switchBucketScript, if buckets swapping it's set to false if (clockIsActive && isCountingDown && !GlobalVars.PAUSED && timeRemaining > 0) { if (!gamesHasBegun && OnStartGame != null) { #if DEBUG Debug.Log("Game has started"); #endif OnStartGame(); gamesHasBegun = true; } timeElapsed += Time.deltaTime; } //sets the timer each time the number of seconds remaining changes //---- isCountingDown boolean is a check for switchBucketScript, if buckets swapping it's set to false if (clockIsActive && isCountingDown && !GlobalVars.PAUSED && timeRemaining > GlobalVars.COLLECT_TIME + timerOffset - timeElapsed + timeAdded) { timeRemaining--; timeTextmesh.text = "" + timeRemaining; generationScript.increaseElementMovementSpeed(rateOfSpeedChange); generationScript.increaseCreationFrequency(rateOfFrequencyChange); } //stops the generation of new elements and destroys the onscreen ones if (timeRemaining == 0) { timeRemaining = -1; this.GetComponent <switchBucketScript>().enabled = false; GameObject finalElement = GenerationScript.findHighestSpawnedElement(); //calls the end game event if (OnEndGame != null) { OnEndGame(); } //ends the game immediately if it's a powerup if (finalElement == null) { endCollectMode(); } else { GlobalVars.GATHERING_CONTROLLER.SetSpawning(false); //adds a game ending script to the final element finalElement.AddComponent <EndGatheringOnDestroy>().setTimerInstance(this); } } // Constantly increase the speed and frequency based on the amount of timeElapsed. generationScript.setElementMovementSpeed(baseElementMovementSpeed + (baseElementMovementSpeed * timeElapsed / (float)(GlobalVars.COLLECT_TIME + timeAdded))); generationScript.setCreationFrequency(baseCreationFrequency + (baseCreationFrequency * timeElapsed / (float)(GlobalVars.COLLECT_TIME + timeAdded))); }
// Use this for initialization void OnDestroy() { GameObject highestElement; //ends the game if this is the highest element if ((highestElement = GenerationScript.findHighestSpawnedElement()) == gameObject || highestElement == null) { timerInstance.endCollectMode(); } else { //if not the highest element, passes the script on and turns off spawning highestElement.AddComponent <EndGatheringOnDestroy>().setTimerInstance(timerInstance); GlobalVars.GATHERING_CONTROLLER.SetSpawning(false); } }
void Start () { //sets the starting time timeRemaining = GlobalVars.COLLECT_TIME+timerOffset; timeTextmesh.text ="" + (timeRemaining - timerOffset); GlobalVars.PAUSED = true; //reference to game controller script generationScript = transform.GetComponent<GenerationScript>(); #if DEBUG //Debug.Log(generationScript.elementMovementSpeed); #endif //sets the base speed and creation frequency // baseElementMovementSpeed = generationScript.elementMovementSpeed; // baseCreationFrequency = generationScript.creationFrequency; // rateOfSpeedChange = (maxElementMovementSpeed - baseElementMovementSpeed)/ (float)GlobalVars.COLLECT_TIME; // rateOfFrequencyChange = (maxCreationFrequency - baseCreationFrequency)/ (float)GlobalVars.COLLECT_TIME; }
void Start() { //sets the starting time timeRemaining = GlobalVars.COLLECT_TIME + timerOffset; timeTextmesh.text = "" + (timeRemaining - timerOffset); GlobalVars.PAUSED = true; //reference to game controller script generationScript = transform.GetComponent <GenerationScript>(); #if DEBUG //Debug.Log(generationScript.elementMovementSpeed); #endif //sets the base speed and creation frequency // baseElementMovementSpeed = generationScript.elementMovementSpeed; // baseCreationFrequency = generationScript.creationFrequency; // rateOfSpeedChange = (maxElementMovementSpeed - baseElementMovementSpeed)/ (float)GlobalVars.COLLECT_TIME; // rateOfFrequencyChange = (maxCreationFrequency - baseCreationFrequency)/ (float)GlobalVars.COLLECT_TIME; }
void Start() { //sets the starting score an element pointsForElement = basePointsForElement; //finds the controller and script references controller = GameObject.FindGameObjectWithTag ("Controller"); // Assigning the generation script. generationScript = controller.GetComponent<GenerationScript>(); }
// Use this for initialization void Start() { //creates reference to controller generationScript = GlobalVars.GATHERING_CONTROLLER; }