void Start() { player = GameObject.Find("Player").GetComponent <Transform>(); playerStats = GameObject.Find("GameManager").GetComponent <PlayerStats>(); enemySpawnManager = GameObject.Find("Enemy Spawn Manager").GetComponent <EnemySpawnManager>(); gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); }
// Update is called once per frame void Update() { if (mPlayerInput.Shoot()) { EnemySpawnManager.getInstance().killAllInvisibleEnemies(); } }
private void OnTriggerEnter(Collider other) { enemySpawnManager = GameObject.Find("Enemy Spawn Manager").GetComponent <EnemySpawnManager>(); playerStats = GameObject.Find("GameManager").GetComponent <PlayerStats>(); if (other.gameObject.CompareTag("Range Enemy")) { prefabs.SetActive(false); rangeEnemy = other.GetComponent <RangeEnemy>(); rangeEnemy.healthRangeEnemy -= playerStats.attackPower; if (rangeEnemy.healthRangeEnemy <= 0) { other.gameObject.SetActive(false); rangeEnemy.healthRangeEnemy = 100; other.gameObject.transform.position = enemySpawnManager.RandomPosition(); rangeEnemy.weaponIsActive = true; } } if (other.gameObject.CompareTag("Melee Enemy")) { prefabs.SetActive(false); meleeEnemy = other.GetComponent <MeleeEnemy>(); meleeEnemy.healthMeleeEnemy -= playerStats.attackPower; if (meleeEnemy.healthMeleeEnemy > 0) { meleeEnemy.SkeletonAnim.SetTrigger("GetDamage"); } } }
void Start() { Instance = this; numEnemies = 0; player = SceneManager.Instance.playerTransform; StartCoroutine(SpawnEnemies()); StartCoroutine(SpawnMoreEnemies()); }
void Awake() { // Initialization. _spawnManager = GameObject.Find(_gameManagerString).GetComponent<EnemySpawnManager>(); _scoreManager = GameObject.Find(_gameManagerString).GetComponent<UIScoreManager>(); _sprite = GetComponent<SpriteRenderer>(); _defaultHP = hp; }
protected override void Start() { base.Start(); _player = _gameManager.Player; _enemySpawnManager = EnemySpawnManager.Instance; }
void Start() { m_spawnTime = m_spawnDelay; m_currentSpawnSpeed = m_spawnSpeed; m_currentSpawnCount = m_spawnCount; m_player = GameObject.FindGameObjectWithTag("Player"); enemySpawnManager = GameObject.FindGameObjectWithTag("EnemySpawnManager").GetComponent <EnemySpawnManager>(); }
public void Awake() { totem = TotemManager.Instance; spawnManger = EnemySpawnManager.Instance; impossible = false; dragCheck = false; }
void Start() { enemySpawnManager = GameObject.FindGameObjectWithTag("EnemySpawnManager").GetComponent <EnemySpawnManager>(); spawnTime = spawnDelay; if (PlayerPrefs.GetInt("EvilExplosion") + PlayerPrefs.GetInt("EvilLightning") + PlayerPrefs.GetInt("EvilFireball") == 0) { Destroy(gameObject); } }
void SetEnemySpawningEnabled(bool value) { EnemySpawnManager m = FindObjectOfType <EnemySpawnManager>(); if (m != null) { (m as ISpawnManager).SetSpawningEnabled(value); } }
private void Start() { var player = GameObject.Find("Player"); respawnPos = player.transform.position; checkpointSceneIndex = 4; _playerController = player.GetComponent <PlayerController>(); enemySpawnManager = new EnemySpawnManager(); nonRespawnableEnemies = new List <GameObject>(); }
private void Start() { if (cam == null) { Debug.LogError("PlayerShoot: No camera referenced"); this.enabled = false; } spawnManager = GetComponent <EnemySpawnManager>(); }
public bool destroyIfNotVisible() { if (!Player.getInstance().isObjectVisibleByPlayer(mCollider)) { EnemySpawnManager.getInstance().removeEnemyFromMap(this); GameObject.Destroy(gameObject); return(true); } return(false); }
public EnemyManager(List <EnemyData> enemyDatas, List <GameObject> enemyPrefabs, float fieldBoundary) { _enemyDatas = enemyDatas; _enemyPrefabs = enemyPrefabs; _enemySpawnManager = new EnemySpawnManager(); _controllerModelPairs = new Dictionary <EnemyController, EnemyModel>(); _viewModelPairs = new Dictionary <EnemyView, EnemyModel>(); _enemyModels = new List <EnemyModel>(); _fieldBoundary = fieldBoundary; }
private void SetMyLaneEnemySpawnManager() { foreach (var enemySpawnManager in enemySpawnManagers) { if (enemySpawnManager.transform.position.y == transform.position.y) { myLaneEnemySpawnManager = enemySpawnManager; break; } } }
// Start is called before the first frame update void Start() { _powerUpSpawnManager = GameObject.Find("PowerUpSpawnManager")?.GetComponent <PowerUpSpawnManager>(); _enemySpawnManager = GameObject.Find("EnemySpawnManager")?.GetComponent <EnemySpawnManager>(); _collider = GetComponent <CircleCollider2D>(); if (_powerUpSpawnManager == null || _enemySpawnManager == null || _collider == null) { Debug.LogError("Important components are missing. The object will destroy itself for safety."); Destroy(gameObject); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
// Start is called before the first frame update void Start() { Time.timeScale = 1.0f; myEnemyManager = this.GetComponent <EnemySpawnManager>(); myMoneyRespawnManager = this.GetComponent <MoneyRespawnManager>(); Player = GameObject.FindGameObjectWithTag("Player"); audio = GetComponent <AudioSource>(); //StartNewRound(); Invoke("StartNewRound", 3); myMoneyManager = GameObject.FindGameObjectWithTag("MoneyManager").GetComponent <MoneyManager>(); textTochange.GetComponent <Text>().text = myMoneyManager.GetScore().ToString(); }
private void Awake() { if (instance != null) { DestroyImmediate(gameObject); return; } instance = this; // Debug.LogWarning("Game manger instance Called"); DontDestroyOnLoad(this); }
public static void ResetData() { //InGameLoop = false; Gameover = false; // QuitGame = false; If we do this here, the outer logic fails. EnemyManager = new EnemySpawnManager(30); AlliedMissileManager = new AlliedMissileManager(); ExplosionManager = new ExplosionManager(); // ImageData = new ImageData(); Bit pointless doing this // AudioManager = new AudioManager(); This too }
public void Damage(int damageValue) { _currentHealth -= damageValue; if (_currentHealth < 0) { _currentHealth = 0; } else { if (_hitSound != null && _hitSound.Length > 0) { AudioSource audio = GetComponent <AudioSource>(); AudioClip soundToUse = _hitSound [Random.Range(0, _hitSound.Length)]; audio.clip = soundToUse; audio.Play(); } } if (_currentHealth == 0) { if (_hitSound != null) { AudioSource audio = GetComponent <AudioSource>(); audio.clip = _deathSound; audio.Play(); } // musuhAudio.Play(); // Destroy (gameObject); Animation anim = GetComponentInChildren <Animation> (); anim.Stop(); _playerStats.ZombieKilled++; EnemyDrops ed = GetComponent <EnemyDrops>(); ed.onDeath(); EnemySpawnManager.onEnemyDeath(); Destroy(GetComponent <EnemyMovement>()); Destroy(GetComponent <EnemyAttack>()); Destroy(GetComponent <CharacterController> ()); Destroy(gameObject, 8.0f); // Destroy (GetComponent<PlayerMovement> ()); // Destroy (GetComponent<PlayerAnimation> ()); Ragdoll r = GetComponent <Ragdoll> (); if (r != null) { r.onDeath(); } } }
void Awake() { if (instance == null) { instance = this; } else if (instance != null) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
private void OnEnable() { _gameManager = GameManager.Instance; _enemySpawnManager = EnemySpawnManager.Instance; float sessionTime = PlayerPrefs.GetFloat("SessionTime", _gameManager.GetDefaultSessionTime()); _gameSessionSlider.value = sessionTime; UpdateSessionHandle(sessionTime); float enemySpawnTime = PlayerPrefs.GetFloat("EnemySpawnTime", _enemySpawnManager.GetDefaultSecondsToSpawn()); _enemySpawnInput.placeholder.GetComponent <TextMeshProUGUI>().text = enemySpawnTime.ToString(); }
private void Awake() { _instance = this; enemyLimit = levels[currentLevel].maxEnemies; if (current == null) { current = this; DontDestroyOnLoad(gameObject); } else { DestroyImmediate(gameObject); return; } }
// Start is called before the first frame update void Start() { gmc = FindObjectOfType <GameManager>(); rounds = gmc.getRoundsList(); SpawnEnemyManager = this; enemyPool = new List <GameObject>(); // Grab spawn positions (remove parent transform) spawnPositionsArray = enemySpawnPositions.GetComponentsInChildren <Transform>(); spawnPositions = new List <Transform>(); for (int i = 1; i < spawnPositionsArray.Length; i++) { spawnPositions.Add(spawnPositionsArray[i]); } }
public override void StartEvent() { base.StartEvent(); Debug.Log("starting spawnEvent"); manager = GameObject.Find("EnemySpawnManager").GetComponent <EnemySpawnManager>(); turrets = GameObject.Find("Turrets").GetComponent <TurretsManager>(); for (int i = 0; i < spawnPoints.Count; ++i) { spawnPoints[i].done = false; spawnPoints[i].delay = spawnPoints[i].initialDelay; } BossManager.instance.SetEmisiveYellow(); AudioSources.instance.PlaySound((int)AudiosSoundFX.Boss_Spawn_Attack); }
void Start() { enemySpawnManager = GameObject.FindObjectOfType <EnemySpawnManager>(); onMouseOverButton = GameObject.FindObjectOfType <OnMouseOverButton>(); onMouseOverButton.onMouseChangePosition += ChangeCursorEvent; ui_Manager = GameObject.FindObjectOfType <UI_Manager>(); ui_Manager.onPauseButtonPressed += ChangeGameState; ui_Manager.onResume += Resume; enemySpawnManager.onEnemySpawn += StartListenEnemyEvents; //register spawned enemy enemySpawnManager.onBossSpawn += StartListenBossEvents; enemySpawnManager.onEnemyWaveSpawned += LevelUp; Invoke("PrepareGame", 0.1f); }
// Start is called before the first frame update void Start() { playerController = GetComponentInParent <PlayerController>(); enemySpawnerScript = enemySpawner.GetComponent <EnemySpawnManager>(); Launcher = GetComponentInChildren <LaunchProjectile>(); rotateTurret = GetComponentInChildren <RotateTurret>(); medkitSpawnerScript = medkitSpawner.GetComponent <MedkitSpawnManager>(); healthText = healthDisplay.GetComponent <Text>(); Health = maxHealth; healthText.text = $"Structural Integrity: {Health}%"; finalScoreDisplayer = finalScoreDisplay.GetComponent <FinalScoreDisplay>(); hitSound = GetComponent <AudioSource>(); gameOver = false; lowHealthNoise = healthDisplay.GetComponent <AudioSource>(); repairNoise = medkitSpawner.GetComponent <AudioSource>(); powerupSpawnerScript = powerupSpawner.GetComponent <PowerupSpawnManager>(); tankMaterial.mainTexture = greenTankTexture; engineNoise = tankParent.GetComponent <AudioSource>(); }
// Start is called before the first frame update void Start() { Debug.Log("Game started"); transform.position = new Vector3(0f, -2.5f, 0f); _enemySpawner = GameObject.Find("EnemySpawnManager")?.GetComponent <EnemySpawnManager>(); _shield = transform.Find("Shield")?.gameObject; _uiManager = GameObject.Find("Canvas")?.GetComponent <UIManager>(); _audioSource = GetComponent <AudioSource>(); if (_enemySpawner == null || _shield == null || _uiManager == null || _audioSource == null) { Debug.LogError("Important element are null, Player will be destroyed for safety!!"); Destroy(gameObject); } else { _audioSource.clip = _laserSound; } }
void Start() { enemiesParent = GameObject.Find("EnemiesPool"); if (_instance == null) { _instance = this; } else if (_instance == this) { Destroy(gameObject); } leftSpawnPoints = spawnPoints.Where(x => x.position.x < -89).ToArray(); rightSpawnPoints = spawnPoints.Where(x => x.position.x > 89).ToArray(); topSpawnPoints = spawnPoints.Where(x => x.position.z > 59).ToArray(); bottomSpawnPoints = spawnPoints.Where(x => x.position.z < -59).ToArray(); foreach (var p in leftSpawnPoints) { p.transform.position = new Vector3(p.transform.position.x - 20, p.transform.position.y, p.transform.position.z); } foreach (var p in rightSpawnPoints) { p.transform.position = new Vector3(p.transform.position.x + 20, p.transform.position.y, p.transform.position.z); } foreach (var p in topSpawnPoints) { p.transform.position = new Vector3(p.transform.position.x, p.transform.position.y, p.transform.position.z + 20); } foreach (var p in bottomSpawnPoints) { p.transform.position = new Vector3(p.transform.position.x, p.transform.position.y, p.transform.position.z - 20); } gameManager = GameManager._instance; gameManager.onGameStateChange += CheckGameState; gameManager.onEnemiesSpawnRequest += PrepareEnemyWave; gameManager.onBossFight += SpawnBoss; }
void Start() { //Define player variables for enemy prefab playerController = GameObject.Find("PlayerController").GetComponent <Player>(); player = GameObject.FindGameObjectWithTag("Player"); gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); enemySpawnManager = GameObject.Find("EnemySpawnManager").GetComponent <EnemySpawnManager>(); enemyEffectsManager = GameObject.Find("EnemyEffectsManager").GetComponent <EnemyEffectsManager>(); //rendHitbody = hitbodyProjection.GetComponent<Renderer>(); rb = GetComponent <Rigidbody>(); if (!isRedemptionDrone) { explosionTextObj.GetComponent <EarnedBulletText>().bulletNumber = enemyGiveBullets; } enemyHealth += enemyEffectsManager.addEnemyHealth; //explosionSoundPitchOriginal = explosionSound.pitch; //enemyHitSoundPitchOriginal = enemyHitSound.pitch; /*if (!isRedemptionDrone) * { * foreach(TextMeshPro text in explosionText) * { * text.text = "+ " + enemyGiveBullets.ToString(); * * } * }*/ // Sets all the mesh renderers stored safely in another array meshRendererOriginals = new Material[meshToChangeOnFlash.Length]; for (int i = 0; i < meshToChangeOnFlash.Length; i++) { meshRendererOriginals[i] = meshToChangeOnFlash[i].GetComponent <Renderer>().material; } //enemyHealth -= (enemyHealth * playerController.enemyNegativeHealthMultiplier); }
// Use this for initialization void Start() { gameInput = InputManager.Instance; enemySpawner = gameObject.GetComponent<EnemySpawnManager>(); uiManager = gameObject.GetComponent<UIManager>(); splashScreen = GameObject.Find("Main Camera").transform.FindChild("SplashScreen").gameObject; /*bool isSignedIn = GameJolt.API.Manager.Instance.CurrentUser != null; if (isSignedIn == false) { GameJolt.UI.Manager.Instance.ShowSignIn((bool success) => { if (success) { playerName = GameJolt.API.Manager.Instance.CurrentUser.Name; isLoggedIn = true; StartGame(); } else { isLoggedIn = false; StartGame(); } }); } else { playerName = GameJolt.API.Manager.Instance.CurrentUser.Name; isLoggedIn = true; StartGame(); }*/ }
void Awake(){ _instance = this; GameObject startPoint = GameObject.Find ("StartPoint"); enemySpawn = new EnemySpawn (); }
// Use this for initialization void Start() { inputManager = InputManager.Instance; gameManager = gameObject.GetComponent<GameManager>(); spawnManager = gameObject.GetComponent<EnemySpawnManager>(); mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>(); inputManager.Mouse_Moved += ProcessMousePosition; playerInfo = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerBehaviour>(); //Get the HUD, populate player health and game stats HUDBar = mainCamera.transform.FindChild("HUDBar").gameObject; for (int i = 0; i < playerInfo.Health; i++) { Vector3 newBlipLocalPosition = new Vector3(healthBlipStartPos.x, healthBlipStartPos.y, 0); GameObject newHealthBlip = GameObject.Instantiate(Resources.Load("Prefabs/Health_Blip") ) as GameObject; float blipWidth = newHealthBlip.GetComponent<SpriteRenderer>().bounds.extents.x * 2; newBlipLocalPosition.x += blipWidth * i; newHealthBlip.transform.parent = HUDBar.transform; newHealthBlip.transform.localPosition = newBlipLocalPosition; healthBlips.Add(newHealthBlip); } waveNumDisplay[0] = HUDBar.transform.FindChild("Wave_Ones").gameObject; waveNumDisplay[1] = HUDBar.transform.FindChild("Wave_Tens").gameObject; waveNumDisplay[2] = HUDBar.transform.FindChild("Wave_Hundreds").gameObject; enemyNumDisplay[0] = HUDBar.transform.FindChild("Enemies_Ones").gameObject; enemyNumDisplay[1] = HUDBar.transform.FindChild("Enemies_Tens").gameObject; enemyNumDisplay[2] = HUDBar.transform.FindChild("Enemies_Hundreds").gameObject; moneyNumDisplay[0] = HUDBar.transform.FindChild("Money_Ones").gameObject; moneyNumDisplay[1] = HUDBar.transform.FindChild("Money_Tens").gameObject; moneyNumDisplay[2] = HUDBar.transform.FindChild("Money_Hundreds").gameObject; crosshair = GameObject.Find("Crosshair"); gameOverPanel = HUDBar.transform.FindChild("GameOverPanel").gameObject; scoreSubmissionStatus = gameOverPanel.transform.FindChild("SubmissionStatus").gameObject; gameOverScoreDisplay[0] = gameOverPanel.transform.FindChild("Score_Ones").gameObject; gameOverScoreDisplay[1] = gameOverPanel.transform.FindChild("Score_Tens").gameObject; gameOverScoreDisplay[2] = gameOverPanel.transform.FindChild("Score_Hundreds").gameObject; numberSprites = Resources.LoadAll<Sprite>("Sprites/UI/UI_Numbers"); ShowHideGameOver(false); shopManager = HUDBar.transform.FindChild("ShopDisplay").GetComponent<ShopManager>(); shopManager.ShowHideShop(false, false); breakTimePanel = HUDBar.transform.FindChild("WaveTimeDisplay").gameObject; breakTimeDisplay[0] = breakTimePanel.transform.FindChild("Seconds_Ones").gameObject; breakTimeDisplay[1] = breakTimePanel.transform.FindChild("Seconds_Tens").gameObject; gameManager.GameOverEvent += OnGameOver; }
// Use this for initialization void Start() { inputManager = InputManager.Instance; gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameManager>(); uiManager = gameManager.GetComponent<UIManager>(); spawnManager = gameManager.GetComponent<EnemySpawnManager>(); playerInfo = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerBehaviour>(); healthButton = gameObject.transform.FindChild("Button_Health").gameObject; pierceButton = gameObject.transform.FindChild("Button_Pierce").gameObject; damageButton = gameObject.transform.FindChild("Button_Damage").gameObject; turretButton = gameObject.transform.FindChild("Button_Turret").gameObject; closeButton = gameObject.transform.FindChild("Button_Close").gameObject; buttonList.Add(healthButton); buttonList.Add(pierceButton); buttonList.Add(damageButton); buttonList.Add(turretButton); buttonList.Add(closeButton); healthPriceDisplay[0] = healthButton.transform.FindChild("Price_Ones").gameObject; healthPriceDisplay[1] = healthButton.transform.FindChild("Price_Tens").gameObject; healthPriceDisplay[2] = healthButton.transform.FindChild("Price_Hundreds").gameObject; piercePriceDisplay[0] = pierceButton.transform.FindChild("Price_Ones").gameObject; piercePriceDisplay[1] = pierceButton.transform.FindChild("Price_Tens").gameObject; piercePriceDisplay[2] = pierceButton.transform.FindChild("Price_Hundreds").gameObject; damagePriceDisplay[0] = damageButton.transform.FindChild("Price_Ones").gameObject; damagePriceDisplay[1] = damageButton.transform.FindChild("Price_Tens").gameObject; damagePriceDisplay[2] = damageButton.transform.FindChild("Price_Hundreds").gameObject; turretPriceDisplay[0] = turretButton.transform.FindChild("Price_Ones").gameObject; turretPriceDisplay[1] = turretButton.transform.FindChild("Price_Tens").gameObject; turretPriceDisplay[2] = turretButton.transform.FindChild("Price_Hundreds").gameObject; closeDelayTimer = new Timer(CLOSE_DELAY_TIME); inputManager.Key_Pressed += ProcessMouseClick; spawnManager.WaveStart += OnWaveStart; closeDelayTimer.OnTimerComplete += SetClosed; gameManager.GameOverEvent += OnGameOver; }
void Spawn () { Instance = this; if(EnemyCleanupManager.Instance != null) shipdead = EnemyCleanupManager.Instance.destroyed; if(shipdead == wavecount*3){ shipCount = 0; wavecount++; count = 1; next = Time.time + delay1; EnemyCleanupManager.Instance.destroyed = 0; } //Debug.Log("shipdead: " + shipdead); if (Time.time > next){ if( shipCount < wavecount*3 ){ if(count == 1 && canSpawn ) { Text wavetext = GameObject.FindGameObjectWithTag("WaveText").GetComponent<Text>(); wavetext.text = "Wave " + wavecount; wavetext.enabled = true; Invoke("Delay", 2); count = 0; } else if (canSpawn) { GameObject enemyShip; shipCount ++; // Find a random index between zero and one less than the number of spawn points. int enemyIndex = Random.Range (0, enemies.Length); int spawnPointIndex = Random.Range (0, spawnPoints.Length); // Create an instance of the enemy prefab at the randomly selected spawn point's position and rotation. enemyShip = Instantiate (enemies [enemyIndex], spawnPoints [spawnPointIndex].position, spawnPoints [spawnPointIndex].rotation) as GameObject; enemyShip.transform.rotation = Quaternion.Euler (0.0f, 90.0f, 0.0f); // Change names to be more readable if (enemyShip.name == "star-wars-vader-tie-fighter(Clone)") { enemyShip.transform.localScale = new Vector3 (0.2f, 0.2f, 0.2f); enemyShip.name = "VaderShip"; } else if (enemyShip.name == "sithcraft(Clone)") { enemyShip.transform.localScale = new Vector3 (0.3f, 0.3f, 0.3f); enemyShip.name = "SithCraft"; } enemyShip.tag = "EnemyShip"; enemyShip.AddComponent<BoxCollider> (); BoxCollider collider = enemyShip.GetComponent<Collider> () as BoxCollider; collider.size = new Vector3 (20.0f, 20.0f, 20.0f); enemyShip.AddComponent<Rigidbody> (); Rigidbody body = enemyShip.GetComponent<Rigidbody> (); body.useGravity = false; enemyShip.AddComponent<EnemyAI> (); EnemyAI ai = enemyShip.GetComponent<EnemyAI> (); ai.playerPosition = playerPosition; } } } }
void Awake(){ _instance = this; }
void Awake() { enemySpawnManagerInstance = this; }