//Decides the first object to spawn in the game private void Awake() { recipeUI = GameObject.Find("RecipeUI"); exitScript = GameObject.FindGameObjectWithTag("Exit").GetComponent <ExitScript>(); recipeScript = GameObject.FindObjectOfType <RecipesScript>(); }
void Start() { //enemyList = new List<Collider>(); //overlappedObjects = new Collider[8]; crackSound = GetComponent <AudioSource>(); exit = GameObject.FindObjectOfType <ExitScript>(); gameObject.GetComponents <BoxCollider>()[1].size = new Vector3(2.1f, 2.0f, 2.1f); }
private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(this.gameObject); } }
void Start() { currentSpawnTimer = timeBetweenSpawns; scoreScript = GameObject.FindGameObjectWithTag("UI").GetComponent<ScoreUIScript>(); exitScript = GameObject.FindGameObjectWithTag("Exit").GetComponent<ExitScript>(); gameTime = 0.0f; Screen.sleepTimeout = SleepTimeout.NeverSleep; coinManager = GameObject.Find("CoinManager").GetComponent<CoinManagerScript>(); }
void Start() { grid = FindObjectOfType <GridScript>(); exit = FindObjectOfType <ExitScript>(); Vector3Int coords = GetCoords(); transform.position = grid.GetSquare(coords.x, coords.z).top; startingPosition = transform.position; startingRotation = transform.rotation; targetPosition = transform.position; buildingLayerMask = LayerMask.GetMask("Buildings"); animator = GetComponentInChildren <Animator>(); SetAnimatorRotation(); }
public void ExitButton() { ExitScript.EndUnityButtonTouched(); }
// Update is called once per frame void Update() { if (startTimer) { lavaTimer += Time.deltaTime; } if (ExitScript.GetState() == 0) { startTimer = true; } else if (once) { once = false; startTimer = false; var a = (maxBonusTime - maxTime) / minBonusTime; var b = maxTime; bonusTime = a * lavaTimer + b; } if (Time.time > nextFire && ExitState.GetLavaFlow() && !stopped) { nextFire = Time.time + FireRate; localPos.y += step; } transform.position = localPos; if (ExitScript.GetState() >= 2) { FireRate = 0.05f; step = 0.5f; } if (transform.position.y >= PointA.position.y) { step = 0.1f; FireRate = 90f / (baseExitTime + bonusTime); } // if (transform.position.y >= PointB.position.y) // { // // Phase 2 // FireRate = 0.05f; // step = 0.1f; // } // if (transform.position.y >= PointC.position.y) // { // // Phase 3 // FireRate = 0.05f; // step = 0.2f; // } // if (transform.position.y >= PointD.position.y) // { // stopped = true; // // Phase 4 // // TODO: GameOver // } // int LayerIndex = LayerMask.NameToLayer("Player"); // int layerMask = (1 << LayerIndex); // Collider2D hit = Physics2D.OverlapArea(Area1.position, Area2.position, layerMask); // if (hit) // { // } }