private void Die() { GameObject spawnerObj = GameObject.FindWithTag("EnemySpawner"); if (spawnerObj != null) { SpawnEnemies spawner = spawnerObj.GetComponent <SpawnEnemies>(); int ind = spawner.enemies.IndexOf(gameObject); if (ind >= 0) { spawner.enemies.Remove(gameObject); StartCoroutine(spawner.Spawn()); Debug.Log(" enemy count: "); Debug.Log(spawner.enemies.Count); } } Destroy(UIobj); Destroy(gameObject); }
private void Start() { spawner = FindObjectOfType <SpawnEnemies>(); Instantiate(enemy, transform.position, transform.rotation); enemy.health = Mathf.RoundToInt(spawner.enemyHealth); enemy.damage = Mathf.RoundToInt(spawner.enemyDamage); }
// Update is called once per frame void Update() { if (GameObject.FindGameObjectWithTag("Player") != null) { Player = GameObject.FindGameObjectWithTag("Player").transform.position; } else { Player = new Vector3(0, 0, 9); } if (checkDead()) { Points p = (Points)GameObject.FindObjectOfType(typeof(Points)); //get the score object PlayerBehaviour player = (PlayerBehaviour)GameObject.FindObjectOfType(typeof(PlayerBehaviour)); //get the player player.killedThisWave++; //keep count of the wave SpawnEnemies se = (SpawnEnemies)GameObject.FindObjectOfType(typeof(SpawnEnemies)); p.points += 10 * se.wave; //update the points if (Random.Range(0f, 1f) <= dropChance) //check whether it should drop { drop = (GameObject)Instantiate(Resources.Load("pre_healthPickup")); drop.transform.position = transform.position; } if (player.killedThisWave >= se.totalThisWave) //if wave is finished, then advance { se.advanceWave(); player.killedThisWave = 0; } Object.Destroy(this.gameObject); } doMove(); }
void Start() { enemy = Resources.Load <GameObject>("Prefabs/Invader1"); _spawnEnemies = new SpawnEnemies(enemy, _rowAmount, _enemiesInRow, _rowLocationX, _rowLocationY, _nextRowLocationX, _nextEnemyPosY); _enemy = new Enemy(); }
void OnDestroy() { if (instance == this) { instance = null; } }
void OnTriggerEnter(Collider col) { if (col.gameObject.layer == LayerMask.NameToLayer(layerToHit)) { if (layerToHit.Equals("Enemy")) { Destroy(col.gameObject); Destroy(gameObject); AudioSource.PlayClipAtPoint(splat, transform.position); SpawnEnemies controller = GameObject.FindGameObjectWithTag("GameController").GetComponent <SpawnEnemies>(); controller.setScore(1); } else { InputController hand = col.gameObject.GetComponent <InputController>(); if (hand.heldObject == null) { hand.catchArrow(gameObject); moveSpeed = 0; layerToHit = "Enemy"; this.gameObject.GetComponent <Collider>().enabled = false; } } } else if (col.gameObject.layer != LayerMask.NameToLayer("Missile") && col.gameObject.layer != LayerMask.NameToLayer("Hand") && col.gameObject.layer != LayerMask.NameToLayer("Body")) { Destroy(gameObject); } }
// Start is called before the first frame update void Start() { float screenAspect = (float)Screen.width / Screen.height; float cameraHeight = Camera.main.orthographicSize; float cameraWidth = cameraHeight * screenAspect; SpawnEnemies spawnScript = GetComponent <SpawnEnemies>(); float spawnerY = cameraHeight * 1.1f; // We offset by an additional 10% so that the enemies spawn out of bounds float spawnerX = cameraWidth * 1.1f; switch (spawnerDirection) { case Direction.Up: spawnScript.transform.position = new Vector2(0, spawnerY); spawnScript.xVariance = cameraWidth; break; case Direction.Down: spawnScript.transform.position = new Vector2(0, -spawnerY); spawnScript.xVariance = cameraWidth; break; case Direction.Left: spawnScript.transform.position = new Vector2(-spawnerX, 0); spawnScript.yVariance = cameraHeight; break; case Direction.Right: spawnScript.transform.position = new Vector2(spawnerX, 0); spawnScript.yVariance = cameraHeight; break; default: throw new ArgumentOutOfRangeException(); } }
void Start() { rooms = new int[7, 7]; spawnEnemies = manager.GetComponent <SpawnEnemies>(); dungeonManager = GameObject.FindGameObjectWithTag("DungeonManager").GetComponent <DungeonManager>(); switch (dungeonManager.dungeonName) { case "Plains": tilePrefab = Resources.Load <GameObject>("Tiles/Tile2").transform; break; case "Caves": tilePrefab = Resources.Load <GameObject>("Tiles/Tile1").transform; break; case "Chasm": tilePrefab = Resources.Load <GameObject>("Tiles/Tile3").transform; break; } generateFloor(); //Debug.Log(numRooms); UpdateConnections(); }
// Use this for initialization void Start() { gameManager = GameObject.Find("GameManager"); spawnEnemies = gameManager.GetComponent <SpawnEnemies>(); spawnPoints = spawnEnemies.GetSpawnPoints(); InvokeRepeating("Teleport", 2f, 2.5f); }
private HealthController healthControllerClassReference; //Referencia a la clase "HealthController". void Awake() { UXControllerClassReference = GameObject.FindWithTag("GameController").GetComponent <UXController> (); spawnEnemiesClassReference = GameObject.FindWithTag("GameController").GetComponent <SpawnEnemies> (); nextSceneClass = GameObject.FindWithTag("GameController").GetComponent <NextScene>(); healthControllerClassReference = gameObject.GetComponent <HealthController>(); }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.GetComponent <RightCollider>()) { Destroy(gameObject); Ship.TurnOffActiveShot(); } else if (other.tag == "Enemy") { Destroy(gameObject); Destroy(other.gameObject); Transform particles = Instantiate(enemyParticlesPrefab, other.transform.position, Quaternion.identity); Destroy(particles.gameObject, 1f); Ship.TurnOffActiveShot(); Ship.AddScore(); SpawnEnemies.RemoveEnemy(); if (SpawnEnemies.GetAmountOfEnemies() == 0 && !SpawnEnemies.StartedGame()) { SceneManager.LoadScene("MainMenu"); } } else if (other.gameObject.GetComponent <EnemyShot>()) { Destroy(gameObject); Destroy(other.gameObject); Ship.TurnOffActiveShot(); } }
// Use this for initialization void Start() { spawnScript = GameObject.FindGameObjectWithTag("Spawner").GetComponent <SpawnEnemies>(); if (canFlash) { FlashInitialize(); } }
void Awake() { if (instance == null) { instance = this; } gameStarted = false; }
// Use this for initialization void Start() { spawnEnemies = gameObject.GetComponent <SpawnEnemies> (); if (spawnEnemies.endlessMode == false) { NextWave(); } }
void Awake() { uxControllerClassReference = GetComponent <UXController> (); nextSceneClass = GetComponent <NextScene>(); spawnEnemiesClassReference = GameObject.FindWithTag("GameController").GetComponent <SpawnEnemies> (); playerTransformReference = GameObject.FindWithTag("Player").GetComponent <Transform>(); playerController = GameObject.FindWithTag("Player").GetComponent <PlayerController>(); }
// Use this for initializat;ion void Start() { spawnEnemies = GetComponent <SpawnEnemies>(); healthController = GetComponent <HealthConroller>(); startWait = new WaitForSeconds(startDelay); endWait = new WaitForSeconds(endDelay); StartCoroutine(GameLoop()); }
// Start is called before the first frame update void Start() { _swordThrowing = GetComponent <SwordThrowing>(); _rigid = gameObject.GetComponent <Rigidbody2D>(); _spawn = GameObject.Find("SpawnArea").GetComponent <SpawnEnemies>(); _master = GameObject.Find("GameMaster").GetComponent <MasterCounter>(); _init = GetComponent <Init>(); }
// Use this for initialization void Start() { currentHealth = startingHealth; healthBar = gameObject.GetComponentInChildren <EnemyHealthBar>(); spawnManager = GameObject.Find("EnemyManager").GetComponent <SpawnEnemies>(); scoreManager = GameObject.Find("ScoreManager").GetComponent <ScoreManager>(); // healthBar.value = calculatedHealth (); }
// Start is called before the first frame update void Start() { playerHealth = 3; h = spawnManager.GetComponent <SpawnEnemies>(); myAnim = gameObject.GetComponent <Animator>(); GameObject.Find("GameStatusText").GetComponent <Text>().text = ""; GameObject.Find("DayText").GetComponent <Text>().text = ""; }
void Awake() { constChangeRate = ChangeRate; player = GameObject.FindGameObjectWithTag("Player"); playerhp = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth>(); EnemySpawn = GameObject.FindGameObjectWithTag("Spawner").GetComponent <SpawnEnemies>(); EnemySpawn.MaxSpawn = 1; }
void Start() { topDoor = this.gameObject.transform.GetChild(0).gameObject; botDoor = this.gameObject.transform.GetChild(1).gameObject; rightDoor = this.gameObject.transform.GetChild(2).gameObject; leftDoor = this.gameObject.transform.GetChild(3).gameObject; enemySpawner = GetComponentInChildren <SpawnEnemies>(); }
void Awake() { spawnEnemiesClass = GameObject.FindWithTag("GameController").GetComponent <SpawnEnemies> (); audioGame = GameObject.FindWithTag("GameController").GetComponent <AudioSource> (); UnityADSInterstitialClass = GameObject.FindWithTag("GameController").GetComponent <UnityADSInterstitial>(); fireButtonAnimator = fireButton.GetComponent <Animator>(); shellButtonAnimator = shellButton.GetComponent <Animator>(); shellButtonImage = shellButton.GetComponent <Image>(); missileButtonImage = missileButton.GetComponent <Image>(); }
/// ///// //Yellow objects switch spots when halfway along their path //////// // Start is called before the first frame update void Start() { newspot = transform.position.x * (-1f); //opposite end of the screen is the newspot the ball will move to transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 0.25f); SE = GameObject.FindGameObjectWithTag("Spawner").GetComponent <SpawnEnemies>(); ChangePoint = 2f * Camera.main.orthographicSize / 2; //the interval at which the balll will switch sides }
void Start() { difficultyLevel = PlayerPrefs.GetInt("difficultyLevel", 0); player = GameObject.Find("Player"); playerVal = player.GetComponent <PlayerValues>(); spawnEnemies = player.GetComponent <SpawnEnemies>(); metersWalkedText = GameObject.Find("InGameCanvas/MetersWalked").GetComponent <Text>(); recordText = GameObject.Find("StartCanvas/Record"); GameObject.Find("WeaponsCanvas/DifficultyLevel").GetComponent <Text>().text = difficultyLevel.ToString(); }
// Use this for initializat;ion void Start() { enemiesKilled = new Dictionary <string, int>(); highScore.text += PlayerPrefs.GetInt("highScore"); spawnEnemies = GetComponent <SpawnEnemies>(); healthController = GetComponent <HealthConroller>(); startWait = new WaitForSeconds(startDelay); endWait = new WaitForSeconds(endDelay); StartCoroutine(GameLoop()); Reset(); }
void Start() { score = FindObjectOfType <Score>(); spawnEnemies = FindObjectOfType <SpawnEnemies>(); y = 0f; originalX = coordonates2Reach.x; shootPeriod = Random.Range(shootTime, shootTime + 2f); StartCoroutine(ShootDelay(shootPeriod)); positionReach = false; newCoords = coordonates2Reach; }
public void Enter() { Debug.Log("entering spawn state"); playerPrefab = Resources.Load <GameObject>("Prefabs/Ship"); enemy = Resources.Load <GameObject>("Prefabs/Invader1"); MyPS.PlayerObject(playerPrefab); _spawnEnemies = new SpawnEnemies(enemy, _rowAmount, _enemiesInRow, _rowLocationX, _rowLocationY, _nextRowLocationX, _nextEnemyPosY); }
// Start is called before the first frame update void Start() { timeIHaveBeenDrained = 0f; alreadyDied = false; eAnim = gameObject.GetComponent <Animator>(); spawnManager = GameObject.Find("SpawnManager"); waveNum = GameObject.Find("WaveText").GetComponent <Text>(); s = spawnManager.GetComponent <SpawnEnemies>(); player = GameObject.Find("Player"); w = player.GetComponent <UseTheWand>(); }
// Start is called before the first frame update void Start() { // Convert the mouse coordinates Vector3 worldMousePos = Input.mousePosition; mousePos = Camera.main.ScreenToWorldPoint(new Vector3(worldMousePos.x, worldMousePos.y, 10)); mouseRadius = 0.5f; wandNum = 0; myAnim = gameObject.GetComponent <Animator>(); playerMana = 0f; s = spawnManager.GetComponent <SpawnEnemies>(); }
// Use this for initialization void Start() { locker = GetComponentInParent<LockGates>(); locked = true; anim = GetComponent<Animation>(); player = GameObject.Find ("Warrior"); roomspawner = GameObject.Find("Room Spawner").GetComponent<RoomSpawner>(); enemies = GameObject.Find ("Spawner").GetComponent<SpawnEnemies>(); exp = GameObject.Find ("Warrior").GetComponent<Experience>(); ga = GameObject.Find ("Spawner").GetComponent<GeneticAlgorithm>(); enemyspawner = GameObject.Find ("Spawner").GetComponent<SpawnEnemies>(); }
private void Awake() { if (SE == null) { SE = this; } else { Destroy(this); return; } }
void Start() { renderer = GetComponent<SpriteRenderer>(); colors[1] = renderer.material.color; waypoints = GameObject.FindGameObjectWithTag("Waypoints") .GetComponent<WaypointController>().waypoints; maxWaypoints = waypoints.Length; spawner = GameObject.Find("SpawnPoint").GetComponent<SpawnEnemies>(); enemyList = spawner.enemies; if (spawnedByEnemy) return; nextWaypoint = 1; target = waypoints[0].transform; }
// Use this for initialization void Start() { if (spawnEnemiesGO) { _spawnEnemies = spawnEnemiesGO.GetComponent<SpawnEnemies>(); if (_spawnEnemies == null) { foreach (Transform child in spawnEnemiesGO.transform) { var otherSpawnEnemies = child.GetComponent<SpawnEnemies>(); if (otherSpawnEnemies != null) { _spawnEnemies = otherSpawnEnemies; break; } } } } }
//################################################################################################# //### UnityEngine void Start() { currentHealthPoints = healthPoints; if(gameObject.CompareTag("Enemy")) { amEnemy = true; } if(!spawner) { spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<SpawnEnemies>(); } }
// Use this for initialization void Start() { spawner = GetComponent<SpawnEnemies>(); numEnemies = spawner.NumberOfEnemies; }
void Start() { rooms = new int[7,7]; spawnEnemies = manager.GetComponent<SpawnEnemies>(); dungeonManager = GameObject.FindGameObjectWithTag("DungeonManager").GetComponent<DungeonManager>(); switch(dungeonManager.dungeonName) { case "Plains": tilePrefab = Resources.Load<GameObject>("Tiles/Tile2").transform; break; case "Caves": tilePrefab = Resources.Load<GameObject>("Tiles/Tile1").transform; break; case "Chasm": tilePrefab = Resources.Load<GameObject>("Tiles/Tile3").transform; break; } generateFloor(); //Debug.Log(numRooms); UpdateConnections(); }
//################################################################################################# //### UnityEngine void Start() { player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent<HasHealth>(); health = gameObject.GetComponent<HasHealth>(); range = Global.global.levelSize / 2.0f; if(!spawner) { spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<SpawnEnemies>(); } }
void Start() { rooms = new int[7,7]; spawnEnemies = manager.GetComponent<SpawnEnemies>(); dungeonManager = GameObject.FindGameObjectWithTag("DungeonManager").GetComponent<DungeonManager>(); generateFloor(); //Debug.Log(numRooms); UpdateConnections(); }
// Use this for initialization void Start() { destroyed = false; holding = false; start = true; position = transform.position; rb = GetComponent<Rigidbody2D>(); rb.isKinematic = true; enemies = GameObject.FindGameObjectWithTag("Castle").GetComponent<SpawnEnemies>(); enemy2 = GameObject.FindGameObjectWithTag("Castle").GetComponent<SpawnEnemy2>(); }