/// <summary> /// Loads the defaults /// </summary> public void LoadDefaults() { MethodBase LoadDefaultsMethod = MethodBase.GetCurrentMethod(); TotalEnemiesToBeSpawned = 0; EnemiesDead = 0; EnemiesDeadInWave = 0; CurrentSpawnedEnemies = 0; CurrentWaveID = 1; SpawnPoints = new List <Transform>(); FindSpawnPoints(); CalculateTotals(); WaveClock = this.gameObject.GetComponent <WaveTimer>(); #region Check if WaveClock exists if (WaveClock == null) { Debug.LogError("Can't load the WaveClock at function call: " + LoadDefaultsMethod.Name + " at script " + this.GetType().Name + " on the GameObject " + this.gameObject.name); #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif } #endregion }
//// MonoBehaviour methods void Awake() { _mouseArrow = this.transform.Find("MouseArrow").gameObject; _overlayUI = this.transform.Find("OverlayUI").gameObject; Transform buttonGroup = _overlayUI.transform.Find("Buttons"); Transform wallButton = buttonGroup.Find("UIButton_Wall"); _wallButtonReference = wallButton.GetComponent <Button>(); _wallButtonImage = wallButton.GetComponent <Image>(); _wallButtonText = wallButton.Find("Text").GetComponent <Text>(); Transform towerButton = buttonGroup.Find("UIButton_Tower"); _towerButtonReference = towerButton.GetComponent <Button>(); _towerButtonImage = towerButton.GetComponent <Image>(); _towerButtonText = towerButton.Find("Text").GetComponent <Text>(); GameObject _popups = this.transform.Find("Popups").gameObject; _endGamePopup = _popups.transform.Find("EndGame").gameObject; _constructionPopup = _popups.transform.Find("Construction").gameObject; _constructionText = _constructionPopup.transform.Find("Text").GetComponent <Text>(); Transform buttonsGroup = _constructionPopup.transform.Find("Buttons"); Transform button1 = buttonsGroup.GetChild(0); _constructionButton1Reference = button1.GetComponent <Button>(); _constructionButton1Text = button1.Find("Text").GetComponent <Text>(); Transform button2 = buttonsGroup.GetChild(1); _constructionButton2Reference = button2.GetComponent <Button>(); _constructionButton2Text = button2.Find("Text").GetComponent <Text>(); _endGameText = _endGamePopup.transform.Find("EndGameText").GetComponent <Text>(); _endGameButtonText = _endGamePopup.transform.Find("Button").Find("Text").GetComponent <Text>(); _waveTimer = _overlayUI.transform.Find("Slider").GetComponent <WaveTimer>(); SetInGameLayout(); }
public override void _Ready() { base._Ready(); if (Engine.EditorHint) { return; } SpawnRadius = GetNode <Area2D>("SpawnRadius"); NavigationManager = GetNode <NavigationManager>("NavigationManager"); GroundTiles = GetNode <TileMap>("Ground"); NavTiles = GetNode <TileMap>("NavigationManager/Map"); OreTiles = GetNode <TileMap>("Ore"); WallTiles = GetNode <TileMap>("Walls"); Buildings = GetNode <Node2D>("Buildings"); GroundEntities = GetNode <Node2D>("GroundEntities"); FlyingEntities = GetNode <Node2D>("FlyingEntities"); Pipes = GetNode <Node2D>("Pipes"); Core = Buildings.GetNode <Building>("Core"); Player = GroundEntities.GetNode <Player>("Player"); NormalControls = GetNode <Control>("UI/NormalControls"); BuildControls = GetNode <Control>("UI/BuildMenuControls"); WaveTimer = GetNode <WaveTimer>("UI/WaveTimer"); LaunchButton = GetNode <Button>("UI/LaunchButton"); FailureBox = GetNode <FailureBox>("UI/FailureBox"); FadeAnimationPlayer = GetNode <AnimationPlayer>("UI/ColorRect/AnimationPlayer"); CallDeferred("Generate"); WaveTimer.Wave = 1; WaveTimer.StartTimer(150); }
private void Awake() { instance = this; }
void Start() { waveTimer = FindObjectOfType <WaveTimer>(); }
//TODO: Error on ine 26 //TODO: Main Menu //TODO: Particles void Awake() { gameManager = GetComponent <GameManager>(); waveTimer = GetComponent <WaveTimer>(); waveUI = GetComponent <WaveUI>(); }