Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. else if (collision.tag == "Bullet")
  2. {
  3. // Only allow the method to fire once (ScoreUpdateSpecial())
  4. _scoreOnce = true;
  5.  
  6. // You killed a boss therefore your counter goes up
  7. UIController.bossSpaceshipCounter++;
  8. Debug.Log(UIController.bossSpaceshipCounter);
  9.  
  10. // Update the score in the score script
  11. _uIController.ScoreUpdateSpecial();
  12.  
  13. // Make a copy of the explosion prefab to indicate an enemy death
  14. Instantiate(_explosionPrefab, transform.position, Quaternion.identity);
  15.  
  16. // Play explosion sound
  17. AudioSource.PlayClipAtPoint(_alienExplosion, Camera.main.transform.position, 1f);
  18.  
  19. // Make a copy of the _textPrefab score to indicate an enemy score
  20. Instantiate(_textPrefab, transform.position + new Vector3(0.1f, 1.1f, 0), Quaternion.identity);
  21.  
  22. // Destroy the left bullet
  23. Destroy(collision.gameObject);
  24. // Destroy the enemy
  25. Destroy(this.gameObject);
  26. }
  27. else if (collision.tag == "Bullet2")
  28. {
  29. if (_scoreOnce == true)
  30. {
  31. // Update the score in the score script to make it double
  32. _uIController.ScoreUpdateSpecialDouble();
  33.  
  34. // Make a copy of the explosion prefab to indicate an enemy death
  35. Instantiate(_explosionPrefab, transform.position, Quaternion.identity);
  36.  
  37. // Play explosion sound
  38. AudioSource.PlayClipAtPoint(_alienExplosion, Camera.main.transform.position, 1f);
  39.  
  40. // Make a copy of the _textPrefab score to indicate an enemy score
  41. Instantiate(_textPrefab, transform.position + new Vector3(0.1f, -1.1f, 0), Quaternion.identity);
  42.  
  43. // Destroy the right bullet
  44. Destroy(collision.gameObject);
  45. // Destroy the enemy
  46. Destroy(this.gameObject);
  47. }
  48.  
  49. // This allows the method to fire once only
  50. if (_scoreOnce == false)
  51. {
  52. // Update the score in the score script
  53. _uIController.ScoreUpdateSpecial();
  54.  
  55. // Make a copy of the explosion prefab to indicate an enemy death
  56. Instantiate(_explosionPrefab, transform.position, Quaternion.identity);
  57.  
  58. // Play explosion sound
  59. AudioSource.PlayClipAtPoint(_alienExplosion, Camera.main.transform.position, 1f);
  60.  
  61. // Make a copy of the _textPrefab score to indicate an enemy score
  62. Instantiate(_textPrefab, transform.position + new Vector3(0.1f, -1.1f, 0), Quaternion.identity);
  63.  
  64. // Destroy the right bullet
  65. Destroy(collision.gameObject);
  66. // Destroy the enemy
  67. Destroy(this.gameObject);
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement