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
void PivotCalculation() | |
{ | |
Vector3 direction = Final_Boss.transform.position - transform.position; | |
direction.Normalize(); | |
float rot_z = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg; | |
transform.rotation = Quaternion.Euler(0f, 0f, rot_z); | |
} | |
void LaserShootRight() | |
{ | |
_direction = Vector3.down; |
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 BossLaserPivot : MonoBehaviour | |
{ | |
private GameObject Final_Boss; | |
Vector3 _direction = Vector3.down; | |
void Start() | |
{ | |
Final_Boss = GameObject.Find("Final_Boss"); | |
} | |
// 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 TempMissile : MonoBehaviour | |
{ | |
[SerializeField] | |
private GameObject[] _enemyLocations; | |
private GameObject _closestEnemy; | |
private float _enemyDistance = 1000f; | |
private float _speed = 3.5f; | |
// Start is called before the first frame update | |
void Start() | |
{ |
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 bool _fireLaser = true; | |
void Update() | |
{ | |
DestroyPowerup(); | |
} | |
private void DestroyPowerup() | |
{ | |
GameObject powerupObj = GameObject.FindGameObjectWithTag("Powerup"); |
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 _explosionPrefab; | |
private void OnTriggerEnter2D(Collider2D other) | |
{ | |
if(other.tag == "Enemy_Laser") |
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
void Start() | |
{ | |
_player = GameObject.Find("Player").GetComponent<Player>(); | |
if(_player == null) | |
{ | |
Debug.Log("Player Not Found"); | |
} | |
} |
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 DodgeEnemy() | |
{ | |
_dodgeEnemy = GameObject.Find("Dodge_Enemy"); | |
if (_dodgeEnemy != null) | |
{ | |
_dodgeEnemy.GetComponent<DodgeEnemy>().PlayerLaserSpawned(); | |
} | |
} |
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 == "Player") | |
{ | |
if (_player != null) | |
{ | |
_player.Damage(); | |
} | |
Explosion(); | |
} |
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 Explosion() | |
{ | |
_explosionSound.Play(); | |
Instantiate(_explosionObject, transform.position, Quaternion.identity); | |
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
public void PlayerLaserSpawned() | |
{ | |
_isPlayerLaserSpawned = true; | |
} |