private void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "Barrier") { Destroy(gameObject); } if (col.gameObject.tag == "Rock") { Rock _rock = col.gameObject.GetComponent <Rock>(); if (_rock != null) { _rock.TakeDamage(); Destroy(gameObject); } } if (col.gameObject.tag == "Alien") { AlienController _alienController = col.gameObject.GetComponent <AlienController>(); if (_alienController != null) { _alienController.Die(); IncreaseScore(10); Destroy(gameObject); } } if (col.gameObject.tag == "Boss") { BossController _bossController = col.gameObject.GetComponent <BossController>(); if (_bossController != null) { _bossController.TakeDamage(); IncreaseScore(5); Destroy(gameObject); } } if (col.gameObject.tag == "Ship") { MotherShip _motherShip = col.gameObject.GetComponent <MotherShip>(); if (_motherShip != null) { _motherShip.Die(); AudioManager.audioManager.PlaySound("Ship Hit"); ShipSpawnStart _shipSpawner = GameObject.FindObjectOfType <ShipSpawnStart>(); _shipSpawner.canWeSpawn = true; _shipSpawner.CreateNewSpawnRate(); IncreaseScore(50); Destroy(gameObject); } } }
private void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag == "Alien") { AlienController _alienController = col.gameObject.GetComponent <AlienController>(); if (_alienController != null) { _alienController.Die(); Destroy(gameObject); } } }