void Awake() { //Only for debug purposes so i can start the main game scene without going on the menu before //Have to remove this try-catch model later, cannot not have a ShipSelector Instance try{ shipSelectorController = GameObject.FindGameObjectWithTag("ShipSelectorController").GetComponent <ShipSelectorController>(); }catch (Exception e) { Debug.Log("Missing ship selector object \n" + e.Message); } //SetDefaultBulletTypeSprite(); SetBulletTypeImagesByIndex(this.shipSelectorController.currentShipTypeIndex); playerShip = GameObject.FindGameObjectWithTag("Ship"); shipAttackHandler = playerShip.GetComponent <ShipAttack>(); shipMovementHandler = playerShip.GetComponent <ShipMovement>(); shipScoreController = GameObject.FindGameObjectWithTag("GameController").GetComponent <ScoreController>(); weaponTypeTimeBar.SetActive(false); if (shipMovementHandler.shipHaveBoost) { boostBarPanel.SetActive(true); } else { boostBarPanel.SetActive(false); } }
void Awake() { //Only for debug purposes so i can start the main game scene without going on the menu before //Have to remove this try-catch model later, cannot not have a ShipSelector Instance try{ shipSelectorController = GameObject.FindGameObjectWithTag("ShipSelectorController").GetComponent <ShipSelectorController>(); if (shipSelectorController.currentShipTypeIndex == 1) { shipHaveBoost = false; } else { shipHaveBoost = true; } }catch (Exception e) { Debug.Log("Missing ship selector controller object \n" + e.Message); } //Debug.Log(shipHaveBoost); //shipHaveBoost = true; shipRigidBody2D = GetComponent <Rigidbody2D>(); shootingPoint = GetComponentInChildren <Transform>(); engineThrustsSprite = GameObject.FindGameObjectWithTag("ShipThrusts").GetComponent <SpriteRenderer>(); //movSpeed = 8f; //rotationSpeed = 300f; shipSizeOffSet = 0.5f; //boostForce = 8f; //boostDelay = 3f; boostingTime = 0.3f; canBoost = true; engineThrustAnimator = engineThrustAnimatorObject.GetComponent <Animator>(); //engineThrustAnimatorObject.SetActive(false); engineThrustsSprite.enabled = false; shipThrustsAudioSource = GetComponent <AudioSource>(); shipThrustsAudioSource.enabled = false; soundController = GameObject.FindGameObjectWithTag("SoundManager").GetComponent <SoundController>(); //Activate as the game start AdjustMovementLimitationBordersBasedOnCamera(); }
void Awake() { try{ shipSelectorController = GameObject.FindGameObjectWithTag("ShipSelectorController").GetComponent <ShipSelectorController>(); }catch (Exception e) { Debug.Log("Missing ship selector object \n" + e.Message); } enemyHealthManager = GetComponent <EnemyHealthManager>(); soundController = GameObject.FindGameObjectWithTag("SoundManager").GetComponent <SoundController>(); if (this.gameObject.tag == "Enemy1_Splitted") { this.hasPassedBorders = true; } else { this.hasPassedBorders = false; } }
void Awake() { //Only for debug purposes so i can start the main game scene without going on the menu before //Have to remove this try-catch model later, cannot not have a ShipSelector Instance try{ shipSelectorController = GameObject.FindGameObjectWithTag("ShipSelectorController").GetComponent <ShipSelectorController>(); shipsHolderReference[shipSelectorController.currentShipTypeIndex].SetActive(true); }catch (Exception e) { //Instatiate default ship shipsHolderReference[0].SetActive(true); Debug.Log("MainGame Scene started via editor directly, loaded deafult ship then \n" + e.Message); } soundController = GameObject.FindGameObjectWithTag("SoundManager").GetComponent <SoundController>(); levelLoaderController = GameObject.FindGameObjectWithTag("LevelLoader").GetComponent <LevelLoader>(); soundController.playMusic(); SetEmittersPositions(); SetGarbageCollectorsPositions(); }
public void Awake() { shipSelectorController = GameObject.FindGameObjectWithTag("ShipSelectorController").GetComponent <ShipSelectorController>(); shipCardsInfo[shipSelectorController.currentShipTypeIndex].SetActive(true); }