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() | |
{ | |
_playerLocation = GameObject.Find("Player"); | |
if(_playerLocation == 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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class EnemyMissle : MonoBehaviour | |
{ | |
private GameObject _playerLocation; | |
[SerializeField] | |
private GameObject _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
CREATE A HEAT-SEEKING MISSLE | |
GRAPHICS | |
--------- | |
SMALL RED MISSLE | |
RESIZED TO ENEMY AND PLAYER TRANSFORM.SCALE | |
VFX | |
--------- | |
EXPLOSION ON COLLIDER CONTACT |
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 CameraShake _playerShake; | |
void Start() | |
{ | |
_playerShake = GameObject.Find("Camera").GetComponent<CameraShake>(); | |
} | |
public void Damage() | |
{ |
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 CameraShake : MonoBehaviour | |
{ | |
[SerializeField] | |
private Camera _mainCam; | |
private bool _cameraShakeEnabled; | |
private float _shakeAmount = 0.01f; |
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
IEnumerator SpawnPowerupRoutine() | |
{ | |
//every 3 - 7 seconds, spawn in a powerup | |
while (_stopSpawning == false) | |
{ | |
float _randomSpawnPosition = Random.Range(-9.0f, 9.0f); | |
Vector3 spawn = new Vector3(_randomSpawnPosition, 7, 0); | |
_randomPowerup = Random.Range(0, 7); | |
if (_bigLaserCount == 5) |
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 _isSlowDownActive = false; | |
[SerializeField] | |
private GameObject _slowDown; | |
[SerializeField] | |
AudioSource _slowDownSound; | |
private WaitForSeconds _fiveSecondsYieldTime = new WaitForSeconds(5.0f); | |
private WaitForSeconds _twoSecondsYieldTime = new WaitForSeconds(2.0f); | |
void CalculateMovement() | |
{ |
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 == "Player") | |
{ | |
Player player = other.GetComponent<Player>(); | |
if (player != null) | |
{ | |
//if powerUp ID is 0 |
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
Player Slowdown Pickup | |
---------------------- | |
Pickup | |
------ | |
sphere object from unity | |
create a pink'ish material | |
needs 2d collider and 2d rigidbody, remove sphere collider | |
need to be added to the spawn manager | |
though not a powerup, will be treated as one, added it to powerup script |
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 int _bigLaserCount; | |
private float _randomNumber; |