public int waveIndex = 0; // TODO make it PRIVATE // Use this for initialization void Start() { Instance = this; normalSkybox = RenderSettings.skybox; audioManager = FindObjectOfType <AudioManager>(); audioManager.Play("mainMusic"); }
// Use this for initialization void Start() { Lives = startLives; GameObject waveSpawnController = GameObject.Find("WaveSpawnController"); waveSpawner = waveSpawnController.GetComponent <WaveSpawner>(); }
private void Awake() { playerBehaviour = FindObjectOfType <PlayerBehaviour>(); waveSpawner = FindObjectOfType <WaveSpawner>(); preSpawnHandler = FindObjectOfType <PreSpawnHandler>(); GM = FindObjectOfType <GameManager>(); }
public EnemyPassiveStrategy(GameObject context) { this.context = context; agent = context.GetComponent <NavMeshAgent>(); spawner = Object.FindObjectOfType <WaveSpawner>(); target = spawner.endPoint; }
private void Awake() { if (Instance != null) { Debug.LogError("Error: More than one wave spawner in scene!"); return; } Instance = this; shop = FindObjectOfType <Shop>(); if (commands == null) { commands = FindObjectOfType <LocalPlayerCommands>(); } if (NetworkServer.connections.Count != 0) { waitForPlayersCount = NetworkServer.connections.Count; } if (cleanUpScene) { CleanUpEnemies(); } InvokeRepeating("UpdateGhostPositions", 0f, UpdateGhostPositionInterval); GenerateAllWaves(); }
void Start() { WaveSpawnerClass = GameObject.Find("wavespawner"); ws = WaveSpawnerClass.GetComponent <WaveSpawner>(); amountWaves = ws.GetAmountOfWaves; amountOfWaves.text = amountWaves.ToString(); }
public override async void _Ready() { _crystal = GetNode <Character>("Crystal"); _waveSpawner = GetNode <WaveSpawner>("WaveSpawner"); _enemyContainer = _waveSpawner.GetEnemyContainer(); _moneyNode = GetNode <MoneyNode>("Hud/Money"); _global = GetTree().Root.GetNode <Global>("Global"); _sceneChanger = GetTree().Root.GetNode <SceneChanger>("SceneChanger"); _jumpScreen = GetNode <JumpScreen>("JumpScreen"); _fireworks = GetNode <Fireworks>("Fireworks"); _deathScreen = GetNode <DeathScreen>("DeathScreen"); _musicPlayer = GetNode <BattleGroundMusicPlayer>("BattleGroundMusicPlayer"); _enemyContainer.Connect(nameof(EnemyContainer.Updated), this, nameof(_OnEnemyContainerUpdated)); _enemyContainer.Connect(nameof(EnemyContainer.EnemyDeath), this, nameof(_OnEnemyDeath)); _stateMachine = new StateMachine(); PauseState = new PauseState(this, _stateMachine); PlayerAttackState = new PlayerAttackState(this, _stateMachine); _stateMachine.Initialize(PlayerAttackState); _jumpScreen.EnterAnimation(); await ToSignal(_jumpScreen, nameof(JumpScreen.AnimationFinished)); foreach (var effect in GetNode <HBoxContainer>("Hud/Effects").GetChildren()) { (effect as Effect).Init(this); } Start(3, _global.Level); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } uniqued = new List <int>(); finished = new List <int>(); difficulty.ResetMultipliers(); armorRestorePercent = 0; hpRestorePercent = 0; atkEnemyPercent = 0; atkPlayerPercent = 0; hpEnemyPercent = 0; SetText(); FillList(); }
// Changed to reflect overall health per CombatZone (WaveSpawner area) public void SetOverhead(WaveSpawner spawner, int numWaves) { enemyPerWave = 0; count = 0; if (spawner.waves[0] == null || numWaves < 1) { Debug.Log("Oops. No wave here."); return; } // if there are no waves for whatever reason for (int i = 0; i < spawner.waves.Length; i++) { // The number of enemies per wave = Wave.count * number of SpawnPoints enemyPerWave = spawner.waves[i].count * spawner.spawnPoints.Length; // Add value of enemyPerWave to total count value count += enemyPerWave; Debug.Log("There are " + enemyPerWave + " enemies in wave " + (i + 1) + "."); } // for iterating through each wave's info in the given WaveSpawner Debug.Log("Count is " + count); totalPool = count * 100; changingPool = totalPool; Debug.Log("Total enemy health is: " + totalPool); healthBar.SetMaxHealth(totalPool); waveInfo.SetBool("OverheadUp", true); //healthCanvas.SetActive(true); readyToDecrease = true; }
// Update is called once per frame void Update() { if (steps == 0 && SteamVR_Input._default.inActions.GrabGrip.GetStateDown(SteamVR_Input_Sources.Any)) { PopupMessage.text = "Let's get you learning the basics: Press \"Left Trigger\" to use your fireball Press \"grip button on either side\" to continue"; } if (steps == 1 && SteamVR_Input._default.inActions.GrabGrip.GetStateDown(SteamVR_Input_Sources.Any)) { PopupMessage.text = "Good! Now press \"Right Trigger\" to use your iceball Press \"grip button on either side\" to continue"; } if (steps == 2 && SteamVR_Input._default.inActions.GrabGrip.GetStateDown(SteamVR_Input_Sources.Any)) { PopupMessage.text = "Good, now press the \"touchpad\" until you teleport back to the base Press \"grip button on either side\" to continue"; } if (steps == 3 && SteamVR_Input._default.inActions.GrabGrip.GetStateDown(SteamVR_Input_Sources.Any)) { PopupMessage.text = "That was all, you should be good to go now! Press \"grip button to close and\" to continue"; } if (steps == 4 && SteamVR_Input._default.inActions.GrabGrip.GetStateDown(SteamVR_Input_Sources.Any)) { PopupMessage.text = ""; WaveSpawner wave = new WaveSpawner(); WaveSpawner waveStarter = wave.GetComponent <WaveSpawner>(); waveStarter.startCount = true; } if (SteamVR_Input._default.inActions.GrabGrip.GetStateUp(SteamVR_Input_Sources.Any)) { steps++; } }
private IEnumerator OnGameStartRoutine() { Timer newTimer = GameUtilities.CreateNewTimer(); float animationFinishTime = waveSpawnerUI.ShowWaveSpawnerUI(); yield return(new WaitForSeconds(animationFinishTime + 0.5f)); newTimer.StartTimer(gameStartTime); while (newTimer != null) { waveSpawnerUI.SetCountdownText(newTimer.TimeLeft); yield return(null); } waveSpawnerUI.SetCountdownText("Round Started!"); yield return(new WaitForSeconds(0.5f)); waveSpawnerUI.HideWaveSpawnerUI(); GameObject waveSpawnerPrefab = Resources.Load <GameObject>("Prefabs/Components/prefab_WaveSpawner"); WaveSpawner newWaveSpawner = Instantiate(waveSpawnerPrefab).GetComponent <WaveSpawner>(); currentWaveSpawner = newWaveSpawner; newWaveSpawner.StartFirstRound(waveSpawnerUI); yield break; }
private void Awake() { rb2d = GetComponent <Rigidbody2D>(); waveSpawner = GetComponent <WaveSpawner>(); anim = GetComponent <Animator>(); healthPlayer = GetComponent <HealthPlayer>(); }
void Start() { waveSpawner = GameObject.Find("WaveSpawner").GetComponent <WaveSpawner>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); weapon = GameObject.Find("Weapon").GetComponent <Weapon>(); animator = GetComponent <Animator>(); }
public void OpenMap() { waveSpawners = player.GetClosestRoom().GetComponentInChildren <WaveSpawner>(); if (waveSpawners != null) { if (waveSpawners.canSpawn == true) { spawnersCanSpawn = true; } waveSpawners.canSpawn = false; } enemies = FindObjectsOfType <EnemyAI>(); for (int i = 0; i < enemies.Length; i++) { enemies[i].TogglePause(); } hearts = FindObjectsOfType <Heart>(); for (int i = 0; i < hearts.Length; i++) { hearts[i].TogglePause(); } player.TogglePause(); mapScreen.SetActive(true); }
// Start is called before the first frame update void Start() { enemyPath = path.GetComponentsInChildren <Transform>(); ws = FindObjectOfType <WaveSpawner>(); NewWave(); }
public List <int> GetActiveSpawnersForWave() { Debug.Log("Getting Active Spawners"); List <int> roundSpawners = new List <int>(); while (roundSpawners.Count < 2) { for (int i = 0; i < waveSpawners.Count; i++) { float randomRoll = Random.Range(0f, 1f); if (randomRoll < waveSpawners[i].GetComponent <WaveSpawner>().activtyChance) { roundSpawners.Add(i); } } } for (int i = 0; i < waveSpawners.Count; i++) { WaveSpawner waveSpawner = waveSpawners[i].GetComponent <WaveSpawner>(); waveSpawner.activtyChance = Mathf.Min(0.8f, waveSpawner.activtyChance + waveSpawner.activtyChanceGrowth); } Debug.Log(roundSpawners.Count); return(roundSpawners); }
void Winner() { WaveSpawner w = GameObject.FindObjectOfType <WaveSpawner>(); WaveSpawner1 w1 = GameObject.FindObjectOfType <WaveSpawner1>(); WaveSpawner2 w2 = GameObject.FindObjectOfType <WaveSpawner2>(); PlayerStats p = GameObject.FindObjectOfType <PlayerStats>(); if (stage == 1 && p.Lives > 0 && w.Wavenumber == 6 && w.EnemiesAlive1 <= 0 && w.EnemiesAlive2 <= 0 && w.BossAlive <= 0 && w.BossAlive2 <= 0) { WinWin.SetActive(true); w.enabled = false; WinDisplayScore.text = "Score " + Score; Unlocker Un = GameObject.FindObjectOfType <Unlocker>(); Un.unlockerlevel2(); LevelManager.score1 = Score; } else if (stage == 2 && p.Lives > 0 && w.Wavenumber == 6 && w.EnemiesAlive1 <= 0 && w.EnemiesAlive2 <= 0 && w.BossAlive <= 0 && w.BossAlive2 <= 0) { WinWin.SetActive(true); w.enabled = false; WinDisplayScore.text = "Score " + Score; Unlocker Un = GameObject.FindObjectOfType <Unlocker>(); Un.unlockerlevel3(); LevelManager.score2 = Score; } else if (stage == 3 && p.Lives > 0 && w.Wavenumber == 6 && w.EnemiesAlive1 <= 0 && w.EnemiesAlive2 <= 0 && w.BossAlive <= 0 && w.BossAlive2 <= 0) { WinWin.SetActive(true); w.enabled = false; WinDisplayScore.text = "Score " + Score; Unlocker Un = GameObject.FindObjectOfType <Unlocker>(); Un.unlockerlevel4(); LevelManager.score3 = Score; } else if (stage == 4 && p.Lives > 0 && w.Wavenumber == 6 && w.EnemiesAlive1 <= 0 && w.EnemiesAlive2 <= 0 && w.BossAlive <= 0 && w.BossAlive2 <= 0) { WinWin.SetActive(true); w.enabled = false; WinDisplayScore.text = "Score " + Score; Unlocker Un = GameObject.FindObjectOfType <Unlocker>(); Un.unlockerlevel5(); LevelManager.score4 = Score; } else if (stage == 5 && p.Lives > 0 && w1.Wavenumber == 6 && w1.EnemiesAlive1 <= 0 && w1.EnemiesAlive2 <= 0 && w1.EnemiesAlive3 <= 0 && w1.BossAlive <= 0 && w1.BossAlive2 <= 0 && w1.BossAlive3 <= 0) { WinWin.SetActive(true); w1.enabled = false; WinDisplayScore.text = "Score " + Score; Unlocker Un = GameObject.FindObjectOfType <Unlocker>(); Un.unlockerlevel6(); LevelManager.score5 = Score; } else if (stage == 6 && p.Lives > 0 && w2.Wavenumber == 6 && w2.EnemiesAlive1 <= 0 && w2.EnemiesAlive2 <= 0 && w2.EnemiesAlive3 <= 0 && w2.EnemiesAlive4 <= 0 && w2.BossAlive <= 0 && w2.BossAlive2 <= 0 && w2.BossAlive3 <= 0 && w2.BossAlive4 <= 0) { WinWin.SetActive(true); w2.enabled = false; LevelManager.score6 = Score; } }
// Update is called once per frame void Update() { //get mic volume int dec = 128; float[] waveData = new float[dec]; int micPosition = (Microphone.GetPosition(null)) - (dec + 1); // null means the first microphone Debug.Log("waveData: " + waveData.ToString()); aud.GetData(waveData, micPosition); // Getting a peak on the last 128 samples float levelMax = 0; for (int i = 0; i < dec; i++) { float wavePeak = waveData[i] * waveData[i]; if (levelMax < wavePeak) { levelMax = wavePeak; } } float level = Mathf.Sqrt(Mathf.Sqrt(levelMax)); Debug.Log("Current input level: " + level); if (level > 0.6f) { activeScream = true; //is screaming WaveSpawner spawn = gameObject.GetComponentInChildren <WaveSpawner>(); //references the spawn script to start spawning spawn.generateRings(); //Instantiate(soundwave, transform.position, transform.rotation); //Debug.Log("AAAAAAAAAAA"); } }
void Start() { myWaveSpawner = gameObject.GetComponent <WaveSpawner>(); SpawnCounterAmount = (myWaveSpawner.GetAmountOfEnemies()) - (myEnemyManager.GetEnemiesKilled()); SpawnCounter.text = "Enemies left:" + SpawnCounterAmount.ToString(); }
void Start() { if (debug) { Debug.Log("Starting map generation..."); } waveSpawner = hostileSpawner.GetComponent <WaveSpawner> (); chunkHolder.transform.position = new Vector3(-chunkDiameter / 2, 0, -chunkDiameter / 2); seedGen = new System.Random(); biomeNoiseInterval = 1 / biomeList.Count; biomeNoiseTopRange = new float[biomeList.Count]; for (int i = 0; i < biomeList.Count; i++) { biomeNoiseTopRange [i] = biomeNoiseInterval + biomeNoiseInterval * i; } biomePrefabs = biomeList [seedGen.Next(0, biomeList.Count)]; if (biomePrefabs != null) { GenerateMap(); perlinSeed = seedGen.Next(arrDimensions); GenerateChunk(0, 0); chunkHolder.GetComponent <ChunkHolder> ().UpdateChunksAroundPlayer(2); } }
void Awake() { if (instance) { Debug.LogError("more than 1 wavespawner, deleting current"); Destroy(this); return; } instance = this; gameManager = GetComponent <GameManager>(); foreach (var s in FindObjectsOfType <Button>(true)) { if (s.CompareTag("StartButton")) { startButton = s; break; } } foreach (var s in FindObjectsOfType <Button>(true)) { if (s.CompareTag("FF")) { FFButton = s; break; } } }
//non built in init function void Start() { Debug.Log("start ran"); this.path_nodes_root = GameObject.Find("Path Nodes"); this.wave_spawner_gameobject = GameObject.Find("Wave Spanwer").GetComponent <WaveSpawner>(); }
// Use this for initialization public void StartDialog() { done = false; if (SceneManager.GetActiveScene().buildIndex != 4 && SceneManager.GetActiveScene().buildIndex != 5) { enemyAI = FindObjectOfType <EnemyAI>(); enemyAI.enabled = false; } Timer = FindObjectOfType <Timer>(); playerController = FindObjectOfType <PlayerController>(); waveSpawner = GetComponent <WaveSpawner>(); if (waveUI != null) { waveUI.SetActive(false); } textTyper = GetComponent <TextTyper>(); dialogBox.SetActive(true); if (sprite2 != null) { sprite2.gameObject.SetActive(false); } if (sprite1 != null) { sprite1.gameObject.SetActive(true); } playerController.enabled = false; StartingDialog(); }
void Start() { playerRigidBody = GetComponent <Rigidbody2D>(); gameSession = FindObjectOfType <GameSession>(); waveSpawner = FindObjectOfType <WaveSpawner>(); diskInstance = 0; jumping = true; }
private void Awake() { if (instance != null && instance != this) { Destroy(this); } instance = this; }
private void Start() { playerStatsReference = PlayerStats.GetInstance(); waveSpawnerReference = WaveSpawner.GetInstance(); speed = startSpeed; health = startHealth; }
// Use this for initialization void Start() { waveS = FindObjectOfType <WaveSpawner>(); wSound = GetComponent <AudioSource>(); //ZombieMask = LayerMask.GetMask ("Zombie"); ZombieMask = (1 << 12) | (1 << 9); ZombieDeadMask = 13; }
private void Awake() { // Needs this inorder for proper working of singleton if (Instance == null) { _instance = this; } }
public void Setup() { //Load Demo Scene SceneManager.LoadScene("Demo", LoadSceneMode.Additive); //Create Spawner in the Scene //game = MonoBehaviour.Instantiate(Resources.Load<GameObject>("Prefabs/Game")); ws = MonoBehaviour.Instantiate(Resources.Load <WaveSpawner>("Prefabs/Spawner")); }
public virtual void Init() { anim = GetComponentInChildren <Animator>(); sprite = GetComponentInChildren <SpriteRenderer>(); uiManager = FindObjectOfType <UIManager>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); wavespawner = FindObjectOfType <WaveSpawner>(); }
// Use this for initialization void Start() { S = this; curLevel= Application.loadedLevelName; if(enemies.Length != delay.Length){ Debug.Log("Wave spawner does not have equal lengths of arrays "); } StartCoroutine (swawnWaves()); }
void OnTriggerStay2D(Collider2D other) { if (other.gameObject.tag == "Player" && Input.GetKey(KeyCode.Space)) { splatSound = GameObject.FindGameObjectWithTag ("SplatSound").GetComponentInParent<AudioSource>(); splatSound.Play (); Debug.Log("punchable"); die(); if (this.gameObject.tag == "Boss") { threatSound = GameObject.FindGameObjectWithTag ("ThreatSound").GetComponentInParent<AudioSource>(); threatSound.Play (); wave = GameObject.FindGameObjectWithTag ("WaveSpawner").GetComponent<WaveSpawner>(); wave.setWin (true); } } }
// Use this for initialization void Start() { //savedTime = Time.time; gameManager = GameObject.FindObjectOfType<GameManager>(); waveSpawner = gameObject.GetComponent<WaveSpawner>(); }
void Start() { waveSpawner = GetComponentInChildren<WaveSpawner>(); playerController = GetComponentInChildren<PlayerController>(); Time.timeScale = startTimeScale; Invoke("RespawnPlayers", introPause); Invoke("NewWave", introPause + wavePause); }
// Use this for initialization void Start() { lineZPostion = Camera.main.transform.position.z + Camera.main.nearClipPlane; Application.targetFrameRate = frameRate; Input.multiTouchEnabled = false; waveSpawner = GetComponent<WaveSpawner>(); miniBossSpawner = GetComponent<MiniBossSpawner>(); }