This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(_gameOverText != null) { | |
_gameOverText.gameObject.SetActive(true); | |
_scoreText.gameObject.SetActive(false); | |
_gameOverText.text = "Game Over!"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Enemy : MonoBehaviour | |
{ | |
private float _speed = 4.0f; | |
// Start is called before the first frame update | |
void Start() | |
{ | |
} | |
// Update is called once per frame |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SpawnManager : MonoBehaviour | |
{ | |
[SerializeField] | |
private GameObject _enemyPreFab; | |
private bool _stopSpawning = false; | |
// Start is called before the first frame update | |
void Start() | |
{ | |
StartCoroutine(SpawnEnemy()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(collision.tag == "Player") | |
{ | |
if(_player != null) | |
{ | |
_player.Damage(); | |
} | |
Destroy(gameObject); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void OnTriggerEnter2D(Collider2D collision) | |
{ | |
if(collision.tag == "Enemy") | |
{ | |
Destroy(this.gameObject); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SerializeField] | |
private GameObject _shield; | |
[SerializeField] | |
private bool _isShieldActive = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(_isShieldActive == true) | |
{ | |
if (_shield != null) { | |
_isShieldActive = false; | |
_shield.SetActive(false); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ShieldsActive() | |
{ | |
if(_shield != null) { | |
_isShieldActive = true; | |
//enable shield visualize | |
_shield.SetActive(true); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void OnTriggerEnter2D(Collider2D other) | |
{ | |
if (other.tag == "Shield") | |
{ | |
Destroy(gameObject); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SpawnManager : MonoBehaviour | |
{ | |
[SerializeField] | |
private GameObject _enemyPrefab; | |
[SerializeField] | |
private GameObject _enemyContainer; |