void Start() { gameOvermenu.SetActive(false); rlm = GameObject.Find("GameController").GetComponent <randomLevelMaker_cfd> (); starsPickedUp = 0; bsae = GameObject.Find("GameController").GetComponent <BombSpawnAndExplode_cfd>(); pc = GetComponent <PlayerController> (); sc = GameObject.Find("GameController").GetComponent <score_counter> (); }
void Start() { player.GetComponent <power_pick_up> ().enabled = true; player.GetComponent <PlayerController> ().enabled = true; ar_camera.GetComponent <player_control_direction_predictor> ().enabled = true; isDead = false; lastSpawnTime = nextSpawnTime = 0.0f; om = GameObject.Find("GameController").GetComponent <ObjectMatrix>(); om.getObjectMatrix(); rows = om.rows; columns = om.columns; rlm = GameObject.Find("GameController").GetComponent <randomLevelMaker_cfd>(); rlm.generateLevel(); //rlm.set_count_canvas (); fire_button_pressed = false; bombs_spawned = 0; sc = GameObject.Find("GameController").GetComponent <score_counter> (); }
void FixedUpdate() { rlm = GameObject.Find("GameController").GetComponent <randomLevelMaker_cfd>(); Debug.Log("powerCount: " + rlm.power_ups_count); if (player == null) { isDead = true; return; } else { //position of bomb bombSpawn = new Vector3(Mathf.Round(player.transform.position.x), Mathf.Round(player.transform.position.y), Mathf.Round(player.transform.position.z)); //comment if don't want to use keyboard keys //if(Input.GetKey(KeyCode.F) && bombs_spawned < max_bombs_allowed && Time.time > nextSpawnTime && (om.level[(int)bombSpawn.x, (int)bombSpawn.z]==null || om.level[(int)bombSpawn.x, (int)bombSpawn.z].layer==10)){ // lastSpawnTime = Time.time;//time of last bomb spawn // nextSpawnTime = lastSpawnTime + bombWaitTime;//predicted time after which bomb spawn is possible // GameObject spawnedBomb = (GameObject)Instantiate(bomb, bombSpawn, Quaternion.identity);//spawned bomb object // Debug.Log(bombs_spawned); // bombs_spawned++; // GameObject tempHolder = null; // bool invisible_check = false; // if (om.level [(int)spawnedBomb.transform.position.x, (int)spawnedBomb.transform.position.z] != null // && om.level [(int)spawnedBomb.transform.position.x, (int)spawnedBomb.transform.position.z].gameObject.layer == 10) { // invisible_check = true; // tempHolder = om.level [(int)spawnedBomb.transform.position.x, (int)spawnedBomb.transform.position.z].gameObject; // } // om.level[(int)spawnedBomb.transform.position.x, (int)spawnedBomb.transform.position.z] = spawnedBomb.gameObject;//filling level matrix with the instantiated bomb // Destroy(om.level[(int)spawnedBomb.transform.position.x, (int)spawnedBomb.transform.position.z],3);//destroying spawned bomb object // Destroy(spawnedBomb,3); // if (invisible_check) { // om.level [(int)spawnedBomb.transform.position.x, (int)spawnedBomb.transform.position.z] = tempHolder; // invisible_check = false; // } // // StartCoroutine(explosionSpawn(bombSpawn, spawnedBomb));//coroutine to do all the explosion stuff of the spwaned bomb //} //used to control through on screen buttons if (fire_button_pressed && bombs_spawned < max_bombs_allowed && Time.time > nextSpawnTime && (om.level[(int)bombSpawn.x, (int)bombSpawn.z] == null || om.level[(int)bombSpawn.x, (int)bombSpawn.z].layer == 10)) { lastSpawnTime = Time.time; //time of last bomb spawn nextSpawnTime = lastSpawnTime + bombWaitTime; //predicted time after which bomb spawn is possible GameObject spawnedBomb = (GameObject)Instantiate(bomb, bombSpawn, Quaternion.identity); //spawned bomb object bombs_spawned++; GameObject tempHolder = null; bool invisible_check = false; if (om.level [(int)spawnedBomb.transform.position.x, (int)spawnedBomb.transform.position.z] != null && om.level [(int)spawnedBomb.transform.position.x, (int)spawnedBomb.transform.position.z].gameObject.layer == 10) { invisible_check = true; tempHolder = om.level [(int)spawnedBomb.transform.position.x, (int)spawnedBomb.transform.position.z].gameObject; } om.level[(int)spawnedBomb.transform.position.x, (int)spawnedBomb.transform.position.z] = spawnedBomb.gameObject; //filling level matrix with the instantiated bomb Destroy(om.level[(int)spawnedBomb.transform.position.x, (int)spawnedBomb.transform.position.z], 3); //destroying spawned bomb object Destroy(spawnedBomb, 3); if (invisible_check) { om.level [(int)spawnedBomb.transform.position.x, (int)spawnedBomb.transform.position.z] = tempHolder; invisible_check = false; } StartCoroutine(explosionSpawn(bombSpawn, spawnedBomb)); //coroutine to do all the explosion stuff of the spwaned bomb } else { fire_button_pressed = false; } } }
void Start() { rlm = GameObject.Find("GameController").GetComponent <randomLevelMaker_cfd> (); sc = GameObject.Find("GameController").GetComponent <score_counter> (); player_dead = false; }