Repository: DaniDevy/LudumDare45
Branch: master
Commit: 82a07eafdd16
Files: 36
Total size: 55.6 KB
Directory structure:
gitextract_g4xbrcvp/
├── LD45/
│ ├── Audio/
│ │ ├── AudioManager.cs
│ │ └── Sound.cs
│ ├── Board/
│ │ ├── GenerateDungeon.cs
│ │ ├── SpawnEnemy.cs
│ │ ├── SpawnProps.cs
│ │ └── StartRoom.cs
│ ├── Camera/
│ │ ├── CameraMovement.cs
│ │ └── CameraShake.cs
│ ├── Game/
│ │ └── Game.cs
│ ├── Other/
│ │ ├── Crate.cs
│ │ ├── Enlighten.cs
│ │ ├── Floor.cs
│ │ ├── Goal.cs
│ │ ├── Laser.cs
│ │ ├── Minimap.cs
│ │ └── Remove.cs
│ ├── Player/
│ │ ├── Actor.cs
│ │ ├── Enemy/
│ │ │ ├── Enemy.cs
│ │ │ └── MeleeEnemy.cs
│ │ ├── Enemy.meta
│ │ └── PlayerMovement.cs
│ ├── UI/
│ │ ├── PlayerStats.cs
│ │ ├── Settings.cs
│ │ └── Timer.cs
│ ├── Upgrades/
│ │ ├── Heart.cs
│ │ ├── Helmet.cs
│ │ ├── IUpgrade.cs
│ │ ├── Sneakers.cs
│ │ └── Soda.cs
│ └── Weapons/
│ ├── Bullet.cs
│ ├── Chest.cs
│ ├── Gun.cs
│ ├── GunContainer.cs
│ ├── Inventory.cs
│ └── Weapon.cs
└── README.md
================================================
FILE CONTENTS
================================================
================================================
FILE: LD45/Audio/AudioManager.cs
================================================
using UnityEngine;
using Random = UnityEngine.Random;
namespace Audio {
public class AudioManager : MonoBehaviour {
public Sound[] sounds;
public bool muted;
public bool muteMusic;
public static AudioManager Instance { get; set; }
void Awake () {
Instance = this;
foreach (Sound s in sounds) {
s.source = gameObject.AddComponent<AudioSource>();
s.source.clip = s.clip;
s.source.loop = s.loop;
s.source.volume = s.volume;
s.source.pitch = s.pitch;
s.source.bypassListenerEffects = s.bypass;
}
Play("Song");
SetVolume(0.7f);
}
public void MuteSounds() {
muted = !muted;
}
public void MuteMusic() {
muteMusic = !muteMusic;
float v;
if (muteMusic) v = 0f;
else v = 1f;
foreach (Sound s in sounds) {
if (s.name == "Song") {
s.source.volume = v;
return;
}
}
}
public void SetVolume(float v) {
foreach (Sound s in sounds) {
if (s.name == "Song") {
s.source.volume = v;
return;
}
}
}
public void UnmuteMusic() {
foreach (Sound s in sounds) {
if (s.name == "Song") {
s.source.volume = 1.15f;
return;
}
}
}
public void Play(string n) {
if (muted && n != "Song") return;
foreach (Sound s in sounds) {
if (s.name == n) {
s.source.Play();
return;
}
}
}
public void Stop(string n) {
foreach (Sound s in sounds) {
if (s.name == n) {
s.source.Stop();
return;
}
}
}
}
}
================================================
FILE: LD45/Audio/Sound.cs
================================================
using UnityEngine;
namespace Audio {
[System.Serializable]
public class Sound {
public string name;
public AudioClip clip;
[Range(0, 2f)]
public float volume;
[Range(0, 2)]
public float pitch;
public bool loop;
public bool bypass;
[HideInInspector]
public AudioSource source;
}
}
================================================
FILE: LD45/Board/GenerateDungeon.cs
================================================
using System;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
public class GenerateDungeon : MonoBehaviour {
public GameObject normalChest, upgradeChest, eliteChest;
private int nRooms = 10;
private int n = 50;
private float scale = 30f;
public GameObject room, enemyRoom, corridor, empty, mark, floorNr, emptyRoom;
private Vector2 spawnPos;
public int[,] rooms;
public List<Tuple<Vector2, Vector2>> roomPositions;
private List<Tuple<Vector2, Vector2>> availableRooms;
private List<Vector2> directionsList;
private List<Vector2> currentDirections;
public List<GameObject> objects;
public static GenerateDungeon Instance { get; set; }
private void Awake() {
Instance = this;
objects = new List<GameObject>();
}
public void DeleteDungeon() {
print("c: " + objects.Count);
foreach (var g in objects) {
Destroy(g);
}
}
public void GenerateNewDungeon() {
roomPositions = new List<Tuple<Vector2, Vector2>>();
rooms = new int[n,n];
directionsList = new List<Vector2>();
directionsList.Add(new Vector2(0, 1));
directionsList.Add(new Vector2(0, -1));
directionsList.Add(new Vector2(1, 0));
directionsList.Add(new Vector2(-1, 0));
Vector2 pos = new Vector2(25,25);
Vector2 size = new Vector2(Random.Range(1, 2), Random.Range(1, 2));
Tuple<Vector2, Vector2> firstRoom = new Tuple<Vector2, Vector2>(pos, size);
roomPositions.Add(firstRoom);
Instantiate(floorNr, pos * scale, Quaternion.identity);
markRoom(firstRoom, 3);
for (int i = 0; i < nRooms; i++) {
int c = 0;
//Dont do this at home kids LOL
while (!GenerateNewRoom()) {
c++;
if (c > 100) break;
}
}
availableRooms = new List<Tuple<Vector2, Vector2>>(roomPositions);
Vector2 finalRoom = availableRooms[availableRooms.Count - 1].Item1;
rooms[(int) finalRoom.x, (int) finalRoom.y] = 3;
FindSpawns();
FindChests();
ShowRooms();
}
private void FindChests() {
int total = Random.Range(3, 5);
print("total: " + total);
int normalChests = Random.Range(1, 4);
total -= normalChests;
int upgradeChests = total;
int eliteChests = 0;
if (Random.Range(0f, 1f) < 0.25f) eliteChests = 1;
for (int i = 0; i < normalChests; i++) {
int r = Random.Range(0, availableRooms.Count);
Vector2 pos = availableRooms[r].Item1;
objects.Add(Instantiate(normalChest, pos * scale, Quaternion.identity));
availableRooms.RemoveAt(r);
rooms[(int) pos.x, (int) pos.y] = 3;
}
for (int i = 0; i < upgradeChests; i++) {
int r = Random.Range(0, availableRooms.Count);
Vector2 pos = availableRooms[r].Item1;
objects.Add(Instantiate(upgradeChest, pos * scale, Quaternion.identity));
availableRooms.RemoveAt(r);
rooms[(int) pos.x, (int) pos.y] = 3;
}
for (int i = 0; i < eliteChests; i++) {
int r = Random.Range(0, availableRooms.Count);
Vector2 pos = availableRooms[r].Item1;
objects.Add(Instantiate(eliteChest, pos * scale, Quaternion.identity));
availableRooms.RemoveAt(r);
rooms[(int) pos.x, (int) pos.y] = 3;
}
}
private void ShowAvailable() {
for (int i = 0; i < availableRooms.Count; i++) {
print(availableRooms[i].Item1.x + ", " + availableRooms[i].Item1.y );
}
}
private void FindSpawns() {
Vector2 playerSpawn = roomPositions[0].Item1;
spawnPos = playerSpawn;
Vector2 bossSpawn = roomPositions[nRooms].Item1;
availableRooms.RemoveAt(nRooms);
availableRooms.RemoveAt(0);
//Instantiate(mark, playerSpawn * scale, Quaternion.identity);
objects.Add(Instantiate(mark, bossSpawn * scale, Quaternion.identity));
}
private void FindRandomLeaf() {
}
private bool GenerateNewRoom() {
int roomNumber = Random.Range(0, roomPositions.Count);
Vector2 npos = roomPositions[roomNumber].Item1;
Vector2 nsize = roomPositions[roomNumber].Item2;
int x = Random.Range(0, (int) nsize.x);
int y = Random.Range(0, (int) nsize.y);
//Find direction to create new room
currentDirections = new List<Vector2>();
currentDirections.Add(new Vector2(0, 1));
currentDirections.Add(new Vector2(0, -1));
currentDirections.Add(new Vector2(1, 0));
currentDirections.Add(new Vector2(-1, 0));
for (int u = 0; u < 4; u++) {
int nr = Random.Range(0, currentDirections.Count);
Vector2 dir = currentDirections[nr] * 2;
currentDirections.RemoveAt(nr);
if (!hasNeighbours(npos + dir)) {
if (nNeighbours(npos+dir) > 2) continue;
Vector2 p = npos + dir;
Vector2 s = nsize;
Tuple<Vector2, Vector2> nRoom = new Tuple<Vector2, Vector2>(p, s);
roomPositions.Add(nRoom);
markRoom(nRoom, 1);
rooms[(int) (npos.x + (dir.x / 2)), (int) (npos.y + (dir.y / 2))] = 2;
return true;
}
}
return false;
}
private bool hasNeighbours(Vector2 pos) {
for (int y = -1; y < 2; y++) {
for (int x = -1; x < 2; x++) {
Vector2 p = new Vector2(x, y) + pos;
if (p.x < 0 || p.x > n || p.y < 0 || p.y > n) continue;
if (rooms[(int) p.x, (int) p.y] != 0)
return true;
}
}
return false;
}
private int nNeighbours(Vector2 pos) {
int count = 0;
if (rooms[(int) pos.x + 2, (int) pos.y] != 0) count++;
if (rooms[(int) pos.x - 2, (int) pos.y] != 0) count++;
if (rooms[(int) pos.x, (int) pos.y + 2] != 0) count++;
if (rooms[(int) pos.x, (int) pos.y - 2] != 0) count++;
return count;
}
private void markRoom(Tuple<Vector2, Vector2> newRoom, int mark) {
Vector2 pos = newRoom.Item1;
Vector2 size = newRoom.Item2;
for (int x = 0; x < size.x; x++) {
rooms[(int) pos.x + x, (int) pos.y] = mark;
}
for (int y = 1; y < size.y; y++) {
rooms[(int) pos.x, (int) pos.y + y] = mark;
}
if (size.x == 2 && size.y == 2)
rooms[(int) pos.x + 1, (int) pos.y + 1] = mark;
}
private void ShowRooms() {
for (int x = 0; x < n; x++) {
for (int y = 0; y < n; y++) {
if (rooms[x, y] == 0) { //nothing
GameObject r = Instantiate(empty, new Vector2(x * scale, y * scale), Quaternion.identity);
r.transform.localScale = Vector2.one * scale;
objects.Add(r);
}
if (rooms[x, y] == 1) { //room
GameObject r = Instantiate(enemyRoom, new Vector2(x * scale, y * scale), Quaternion.identity);
r.transform.localScale = Vector2.one * scale;
objects.Add(r);
}
else if (rooms[x, y] == 2) { //corridor
float a = 0;
if (rooms[x + 1, y] == 1 || rooms[x - 1, y] == 1) a = 90;
if (rooms[x + 1, y] == 3 || rooms[x - 1, y] == 3) a = 90;
Vector2 s = corridor.transform.localScale * scale;
GameObject r = Instantiate(corridor, new Vector2(x * scale, y * scale), Quaternion.Euler(new Vector3(0,0,a)));
r.transform.localScale = s;
objects.Add(r);
}
else if (rooms[x, y] == 3) {
GameObject r = Instantiate(emptyRoom, new Vector2(x * scale, y * scale), Quaternion.identity);
r.transform.localScale = Vector2.one * scale;
objects.Add(r);
}
}
}
}
public Vector2 GetSpawnPos() {
return spawnPos * scale;
}
}
================================================
FILE: LD45/Board/SpawnEnemy.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
public class SpawnEnemy : MonoBehaviour {
public GameObject enemy, p, spawnPopFx;
public ParticleSystem ps;
private void Start() {
Invoke(nameof(Spawn), Random.Range(1f, 2f));
ParticleSystem.MainModule m = ps.main;
m.startColor = enemy.GetComponent<SpriteRenderer>().color;
}
private void Spawn() {
enemy.SetActive(true);
Destroy(p);
ParticleSystem ps2 = Instantiate(spawnPopFx, transform.position, Quaternion.identity).GetComponent<ParticleSystem>();
ParticleSystem.MainModule m2 = ps2.main;
m2.startColor = enemy.GetComponent<SpriteRenderer>().color;
}
}
================================================
FILE: LD45/Board/SpawnProps.cs
================================================
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpawnProps : MonoBehaviour {
public GameObject barrel;
public GameObject crate;
public GameObject wall;
public GameObject lava;
public bool walls;
void Start() {
int crates = Random.Range(0, 3);
for (int i = 0; i < crates; i++) {
Vector3 pos = new Vector3(Random.Range(-10, 10), Random.Range(-10, 10));
GenerateDungeon.Instance.objects.Add(Instantiate(crate, transform.position + pos, Quaternion.identity));
}
if (walls) {
int walls = Random.Range(0, 4);
for (int i = 0; i < walls; i++) {
Vector3 pos = new Vector3(Random.Range(-7, 7), Random.Range(-7, 7));
Vector3 r = new Vector3(0, 0, Random.Range(1, 3) * 90);
GenerateDungeon.Instance.objects.Add(Instantiate(wall, transform.position + pos, Quaternion.Euler(r)));
}
}
}
}
================================================
FILE: LD45/Board/StartRoom.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using Audio;
using UnityEngine;
using Random = UnityEngine.Random;
public class StartRoom : MonoBehaviour {
public SpriteRenderer doorSprite;
public GameObject colliders, roomfade, enemy;
private bool started;
private int waves, currentWave;
private float roomSize;
private List<GameObject> enemies;
private bool readyToCheck = true;
private void Awake() {
enemies = new List<GameObject>();
roomSize = 28f;
}
private void OnTriggerEnter2D(Collider2D other) {
if (started) return;
if (other.gameObject.CompareTag("Player")) {
CameraMovement.Instance.SetRoom(transform);
CameraShake.ShakeOnce(0.5f, 2f);
AudioManager.Instance.Play("DoorOpen");
doorSprite.sortingOrder = 1;
colliders.SetActive(true);
roomfade.SetActive(true);
started = true;
waves = Game.Instance.GetWaveAmount();
currentWave = 1;
}
}
private void FixedUpdate() {
if (!started || !readyToCheck) return;
CheckEnemyList();
if (enemies.Count == 0) {
if (currentWave > waves) {
FinishRoom();
return;
}
SpawnEnemies();
currentWave++;
readyToCheck = false;
}
}
private void CheckEnemyList() {
for (int i = 0; i < enemies.Count; i++) {
if (enemies[i] == null)
enemies.RemoveAt(i);
}
}
private void SpawnEnemies() {
print("spawning bois");
int n = Game.Instance.GetEnemyAmount();
for (int i = 0; i < n; i++) {
Invoke(nameof(SpawnOneEnemy), Random.Range(0, 7));
}
Invoke(nameof(GetCheckReady), 7f);
}
private void GetCheckReady() {
readyToCheck = true;
}
private void SpawnOneEnemy() {
GameObject e = SelectEnemy();
Vector3 p = (transform.position + new Vector3(Random.Range(-roomSize / 2, roomSize / 2),Random.Range(-roomSize / 2, roomSize / 2), 0));
enemies.Add(Instantiate(e, p, Quaternion.identity).transform.GetChild(0).gameObject);
}
private GameObject SelectEnemy() {
return Game.Instance.GetEnemy();
}
public void FinishRoom() {
doorSprite.sortingOrder = -1;
colliders.SetActive(false);
roomfade.SetActive(false);
CameraMovement.Instance.SetRoom(null);
AudioManager.Instance.Play("DoorClose");
Destroy(this);
}
}
================================================
FILE: LD45/Camera/CameraMovement.cs
================================================
using System;
using UnityEngine;
public class CameraMovement : MonoBehaviour {
public Transform player;
private float speed = 0.7f;
private Vector2 velSpeed;
private float defaultZoom = 8f;
private float zoomSpeed = 1f;
private float velZoom;
private Vector2 startPos;
private Transform roomT;
public Camera c;
public static CameraMovement Instance { get; set; }
private void Awake() {
Instance = this;
startPos = transform.position;
}
void FixedUpdate () {
if (player == null) return;
//Movement
float playerSpeed = PlayerMovement.Instance.GetRb().velocity.magnitude;
Vector2 posOffset = PlayerMovement.Instance.GetRb().velocity / 1.75f;
Vector2 myPos = new Vector2(player.transform.position.x, player.transform.position.y) + posOffset;
//Stay within room bounds
if (roomT != null) {
Vector2 roomPos = roomT.position;
float offset = 10f;
if (myPos.x > roomPos.x + offset) myPos = new Vector2(roomPos.x + offset, myPos.y);
else if (myPos.x < roomPos.x - offset) myPos = new Vector2(roomPos.x - offset, myPos.y);
if (myPos.y > roomPos.y + offset) myPos = new Vector2(myPos.x, roomPos.y + offset);
else if (myPos.y < roomPos.y - offset) myPos = new Vector2(myPos.x, roomPos.y - offset);
}
transform.position = Vector2.SmoothDamp(transform.position, myPos, ref velSpeed, speed);
if (playerSpeed > 11) playerSpeed = 11;
//Zoom
float desiredZoom = defaultZoom + (playerSpeed / 4); //+ height;
Camera.main.orthographicSize =
Mathf.SmoothDamp(Camera.main.orthographicSize, desiredZoom, ref velZoom, zoomSpeed);
transform.position = new Vector3(transform.position.x, transform.position.y, -10);
}
public void SetPlayer(Transform t) {
player = t;
}
public void StartRound() {
c.orthographicSize = 0.1f;
transform.position = player.transform.position;
}
public void SetRoom(Transform pos) {
roomT = pos;
}
}
================================================
FILE: LD45/Camera/CameraShake.cs
================================================
using UnityEngine;
using Random = UnityEngine.Random;
public class CameraShake : MonoBehaviour {
public Transform camTransform;
private static float shakeDuration = 0f;
private static float shakeAmount = 0.7f;
private float vel;
private Vector3 vel2 = Vector3.zero;
Vector3 originalPos;
void Awake() {
if (camTransform == null) {
camTransform = transform;
}
originalPos = camTransform.localPosition;
}
public static void ShakeOnce(float lenght, float strength) {
shakeDuration = lenght;
shakeAmount = strength;
}
void Update() {
if (shakeDuration > 0) {
Vector3 newPos = originalPos + Random.insideUnitSphere * shakeAmount;
camTransform.localPosition = Vector3.SmoothDamp(camTransform.localPosition, newPos, ref vel2, 0.05f);
shakeDuration -= Time.deltaTime;
shakeAmount = Mathf.SmoothDamp(shakeAmount, 0, ref vel, 0.7f);
}
else {
camTransform.localPosition = originalPos;
}
}
}
================================================
FILE: LD45/Game/Game.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using Random = UnityEngine.Random;
public class Game : MonoBehaviour {
public GameObject player;
public GameObject menuUI, gameUI, deadUI;
public GameObject[] enemies;
public int floor = 1;
public bool playing;
public static Game Instance { get; set; }
public TextMeshProUGUI doneText;
private void Awake() {
Instance = this;
}
public void NextFloor() {
GenerateDungeon.Instance.DeleteDungeon();
GenerateDungeon.Instance.GenerateNewDungeon();
PlayerMovement.Instance.gameObject.transform.position = GenerateDungeon.Instance.GetSpawnPos();
CameraMovement.Instance.StartRound();
floor++;
Minimap.Instance.LoadMap();
}
public void StartGame() {
GenerateDungeon.Instance.GenerateNewDungeon();
Vector2 spawnPos = GenerateDungeon.Instance.GetSpawnPos();
GameObject p = Instantiate(player, spawnPos, Quaternion.identity);
CameraMovement.Instance.SetPlayer(p.transform);
CameraMovement.Instance.StartRound();
Timer.Instance.StartTimer();
playing = true;
floor = 1;
PlayerMovement.Instance.ResetPlayer();
Minimap.Instance.LoadMap();
}
public float GetFirerateMultiplier() {
float f = Timer.Instance.GetMinutes() / 3;
if (f == 0) f = 1;
if (f == 5) f = 5;
return 5 / f;
}
public float GetSpeedMultiplier() {
float f = Timer.Instance.GetMinutes() / 30;
if (f > 0.5f) f = 0.5f;
return 0.5f + f;
}
public int GetEnemyAmount() {
int min = Timer.Instance.GetMinutes();
int mi = 1 + (int) Mathf.Floor(min / 2);
int ma = (int) Mathf.Floor(min / 1.5f);
if (ma < 3) ma = 3;
if (ma > 10) ma = 10;
if (mi < 2) mi = 2;
print("min: " + mi + ", m: " + ma);
return Random.Range(mi, ma);
}
public int GetWaveAmount() {
int min = Timer.Instance.GetMinutes();
int ma = (int) Mathf.Floor(min / 4);
if (ma > 4) ma = 4;
if (ma < 2) ma = 2;
return Random.Range(1, ma);
}
public GameObject GetEnemy() {
int min = Timer.Instance.GetMinutes() / 4;
int m = 2 + min;
if (m > enemies.Length) m = enemies.Length;
print("max: " + m);
int max = Random.Range(0, m);
print("r: " + max);
return enemies[max];
}
public void PlayerDied() {
deadUI.SetActive(true);
gameUI.SetActive(false);
GenerateDungeon.Instance.DeleteDungeon();
doneText.text = "You made it to floor " + floor;
PlayerStats.Instance.gun1.sprite = null;
PlayerStats.Instance.gun2.sprite = null;
}
public int GetEnemyHealth() {
int min = Timer.Instance.GetMinutes() / 3;
return min;
}
public void ExitGame() {
Application.Quit(1);
}
}
================================================
FILE: LD45/Other/Crate.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using Audio;
using UnityEngine;
using Random = UnityEngine.Random;
public class Crate : MonoBehaviour {
public GameObject breakFx;
public GameObject[] items;
private Collider2D[] playerColliders;
private Collider2D myCollider;
public bool e;
private bool coin;
private void Start() {
GenerateDungeon.Instance.objects.Add(gameObject);
}
public void Break() {
Instantiate(breakFx, transform.position, Quaternion.identity);
playerColliders = PlayerMovement.Instance.GetColliders();
print(playerColliders);
GameObject weapon = SelectWeapon(e);
GameObject w = Instantiate(weapon, transform.position, transform.rotation);
Vector2 dir = (transform.position - PlayerMovement.Instance.transform.position).normalized;
w.GetComponent<Rigidbody2D>().AddForce((dir * 300) + new Vector2(Random.Range(-400, 400), Random.Range(-400, 400)));
w.GetComponent<Rigidbody2D>().AddTorque(Random.Range(-2000,2000));
CameraShake.ShakeOnce(0.2f, 1.5f);
AudioManager.Instance.Play("Hit2");
myCollider = w.GetComponent<Collider2D>();
RemoveCollision();
gameObject.SetActive(false);
GenerateDungeon.Instance.objects.Add(w);
}
private void RemoveCollision() {
for (int i = 0; i < playerColliders.Length; i++) {
Physics2D.IgnoreCollision(playerColliders[i], myCollider, true);
}
Invoke(nameof(ResumeCollision), 0.8f);
}
private void ResumeCollision() {
print("start colliding again");
for (int i = 0; i < playerColliders.Length; i++) {
Physics2D.IgnoreCollision(playerColliders[i], myCollider, false);
}
}
private GameObject SelectWeapon(bool e) {
if (Random.Range(0f, 1f) > 0.2f) {
coin = true;
return items[0];
}
int u = Mathf.FloorToInt(0 + (items.Length - 1) * Mathf.Pow(Random.Range(0f, 1f), 2));
u += 1;
return items[u];
}
}
================================================
FILE: LD45/Other/Enlighten.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enlighten : MonoBehaviour
{
private void OnTriggerEnter2D(Collider2D other) {
other.gameObject.GetComponent<SpriteRenderer>().color = Color.white;
print("lighting");
}
}
================================================
FILE: LD45/Other/Floor.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class Floor : MonoBehaviour {
public TextMeshProUGUI text;
public GameObject descriptionText;
private void Start() {
int floor = Game.Instance.floor;
text.text = "Floor " + floor;
if (floor > 1)
descriptionText.SetActive(false);
else descriptionText.SetActive(true);
GenerateDungeon.Instance.objects.Add(gameObject);
}
}
================================================
FILE: LD45/Other/Goal.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Goal : MonoBehaviour {
private bool done;
private void OnTriggerEnter2D(Collider2D other) {
if (done) return;
if (other.gameObject.CompareTag("Player")) {
done = true;
Game.Instance.NextFloor();
}
}
}
================================================
FILE: LD45/Other/Laser.cs
================================================
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Laser : MonoBehaviour {
private Transform target;
public LineRenderer lr;
void Start() {
target = PlayerMovement.Instance.transform;
lr.transform.parent = null;
lr.transform.position = Vector2.zero;
}
// Update is called once per frame
void Update() {
print(target);
if (target == null) return;
lr.SetPosition(0, transform.position);
lr.SetPosition(1, target.position);
}
}
================================================
FILE: LD45/Other/Minimap.cs
================================================
using System;
using System.Collections.Generic;
using UnityEngine;
public class Minimap : MonoBehaviour {
private List<Tuple<Vector2, Vector2>> layout;
public Material mat;
private GameObject player;
public GameObject room;
public Transform p;
private LineRenderer lr;
private Transform playerT;
public static Minimap Instance { get; set; }
private void Awake() {
Instance = this;
/*
lr = p.gameObject.AddComponent<LineRenderer>();
lr.startColor = Color.white;
lr.startWidth = 10f;
lr.transform.parent = p;
lr.sortingOrder = 10;
lr.sortingLayerName = "UI";
lr.material = mat;
*/
}
public void LoadMap() {
for (int i = p.childCount - 1; i >= 0; i--) {
Destroy(p.GetChild(i).gameObject);
}
layout = GenerateDungeon.Instance.roomPositions;
Vector2 pos2 = PlayerMovement.Instance.transform.position / 30f;
player = Instantiate(room, pos2, Quaternion.identity);
player.transform.parent = p;
player.transform.localPosition = pos2;
player.transform.localScale *= 0.25f;
player.GetComponent<SpriteRenderer>().color = Color.blue;
player.GetComponent<SpriteRenderer>().sortingOrder = 5;
for (int i = 0; i < layout.Count; i++) {
Vector2 pos = layout[i].Item1 - new Vector2(25, 25);
pos *= 8;
GameObject g = Instantiate(room, pos, Quaternion.identity);
g.transform.parent = p;
g.transform.localPosition = pos;
g.transform.localScale *= 0.25f;
}
playerT = PlayerMovement.Instance.transform;
}
private void Update() {
if (player == null || playerT == null) return;
Vector3 pos = ((playerT.position / 30f) - new Vector3(25, 25)) * 8f;
Vector3 pPos = new Vector3((int) pos.x, (int)pos.y);
player.transform.localPosition = pPos;
/*
lr.positionCount++;
lr.SetPosition(lr.positionCount - 1, player.transform.position);
*/
for (int i = 0; i < layout.Count; i++) {
}
}
}
================================================
FILE: LD45/Other/Remove.cs
================================================
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Remove : MonoBehaviour {
// Start is called before the first frame update
void Start() {
Invoke(nameof(KillSelf), 1f);
}
private void KillSelf() {
Destroy(gameObject);
}
}
================================================
FILE: LD45/Player/Actor.cs
================================================
using System;
using System.Collections.Generic;
using Audio;
using UnityEngine;
using Random = UnityEngine.Random;
public class Actor : MonoBehaviour {
public float speed;
protected Rigidbody2D rb;
public GameObject killFx, bullet, coin;
protected Inventory inventory;
protected int dashCooldown;
protected bool dashing;
protected Vector2 dashDir;
protected float dashSpeed = 15f;
protected int dashDuration = 35;
protected int dashC;
protected Gun gun = GunContainer.rustyPistol;
protected bool readyToFire = true;
protected SpriteRenderer sr;
protected Color dColor;
[SerializeField]
protected int health = 5;
public ParticleSystem ps;
private ParticleSystem.EmissionModule em;
protected virtual void Init() { }
private void Awake() {
ps = GetComponentInChildren<ParticleSystem>();
em = ps.emission;
rb = GetComponent<Rigidbody2D>();
Init();
sr = GetComponent<SpriteRenderer>();
dColor = sr.color;
}
protected void Aim(Vector3 target) {
Vector2 dir = transform.position - target;
float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(new Vector3(0,0, angle + 90));
}
protected void Move(Vector2 dir) {
float pen = 1;
if ((dir.x > 0.5f || dir.x < -0.5f) && (dir.y > 0.5f || dir.y < -0.5f)) {
pen = 1.35f;
}
rb.velocity = dir.normalized * GetSpeed() * pen;
}
protected virtual float GetSpeed() {
return speed;
}
protected void Dash(Vector2 dir) {
if (dashCooldown > 0) return;
AudioManager.Instance.Play("Dash");
float pen = 1;
if ((dir.x > 0.5f || dir.x < -0.5f) && (dir.y > 0.5f || dir.y < -0.5f)) {
pen = 0.8f;
}
rb.angularVelocity = 0f;
em.enabled = true;
dashing = true;
dashDir = dir * pen;
dashC = 0;
dashCooldown = 200;
CameraShake.ShakeOnce(0.25f, 1);
}
protected void StopDash() {
dashDir = Vector2.zero;
dashing = false;
em.enabled = false;
rb.angularVelocity = 0f;
}
protected virtual void KillActor() {
GameObject fx = Instantiate(killFx, transform.position, Quaternion.identity);
ParticleSystem.MainModule mm = fx.GetComponent<ParticleSystem>().main;
mm.startColor = dColor;
AudioManager.Instance.Play("Explosion1");
int a = Random.Range(1, 7);
for (int i = 0; i < a; i++) {
GameObject c = Instantiate(coin, transform.position, Quaternion.identity);
GenerateDungeon.Instance.objects.Add(c);
c.GetComponent<Rigidbody2D>().AddForce(new Vector2(Random.Range(-500, 500), Random.Range(-500, 500)));
}
Destroy(gameObject);
}
public virtual void Damage(Vector2 dir, int damage) {
health -= damage;
if (health < 1)
KillActor();
AudioManager.Instance.Play("EnemyHit1");
CancelInvoke(nameof(ResetColor));
sr.color = Color.white;
Invoke(nameof(ResetColor), 0.05f);
}
private void ResetColor() {
sr.color = dColor;
}
protected void Fire() {
if (gun == null) return;
if (!readyToFire) return;
readyToFire = false;
AudioManager.Instance.Play("Shoot");
for (int i = 0; i < gun.GetBullets(); i++) {
GameObject b = Instantiate(bullet, transform.position + (transform.up / 1.5f), transform.rotation);
if (gameObject.layer == LayerMask.NameToLayer("Player")) {
b.layer = LayerMask.NameToLayer("PlayerBullet");
} else b.layer = LayerMask.NameToLayer("EnemyBullet");
Rigidbody2D brb = b.GetComponent<Rigidbody2D>();
b.GetComponent<SpriteRenderer>().color = dColor;
((Bullet) b.GetComponent(typeof(Bullet))).SetDamage(gun.GetDamage());
float s = gun.GetDamage() / 2;
if (s > 0.5f) s = 0.5f;
b.transform.localScale *= 1 + s;
GenerateDungeon.Instance.objects.Add(b);
Vector2 dir = transform.rotation * Vector2.up;
Vector2 pdir = Vector2.Perpendicular(dir) * Random.Range(-gun.GetSpread(), gun.GetSpread());
brb.velocity = (dir + pdir) * gun.GetSpeed() * GetSpeedMultiplier();
}
float f = gun.GetFireRate();
Invoke(nameof(FireCooldown), gun.GetFireRate() * GetFirerateMultiplier());
}
protected void FireCooldown() {
readyToFire = true;
}
private void OnCollisionEnter2D(Collision2D other) {
if (dashing) {
if (other.gameObject.layer == LayerMask.NameToLayer("BlockPlayer")) {
if (!other.gameObject.CompareTag("Crate"))
StopDash();
}
}
}
protected float GetSpeedMultiplier() {
if (gameObject.layer == LayerMask.NameToLayer("Enemy"))
return Game.Instance.GetSpeedMultiplier();
return 1;
}
protected float GetFirerateMultiplier() {
if (gameObject.layer == LayerMask.NameToLayer("Enemy"))
return Random.Range(2, Game.Instance.GetFirerateMultiplier());
return GetFireRate();
}
protected virtual float GetFireRate() {
return 2;
}
}
================================================
FILE: LD45/Player/Enemy/Enemy.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
public class Enemy : Actor {
private Transform target;
private Vector3 bias;
private int c;
private float biasStrength = 8f;
public LayerMask whatIsWall;
public int gunNr;
public int desiredDist;
public int moveAwayDist;
protected override void Init() {
target = PlayerMovement.Instance.transform;
if (gunNr == -1)
gun = GunContainer.GetRandomGun();
else
gun = GunContainer.GetGun(gunNr);
bias = new Vector2(Random.Range(-1f, 1f), Random.Range(-1f,1f)) * biasStrength;
readyToFire = false;
Invoke(nameof(FireCooldown), gun.GetFireRate() * GetFirerateMultiplier());
health += Game.Instance.GetEnemyHealth();
GenerateDungeon.Instance.objects.Add(gameObject);
}
private void Update() {
if (target == null) return;
Vector2 tp = target.position;
Vector2 p = transform.position;
float dist = Vector2.Distance(tp, p);
if (dist > desiredDist)
Move((target.position - transform.position) + bias);
else if (dist < moveAwayDist) {
Move((transform.position - target.position) + bias);
}
else {
rb.velocity = Vector2.zero;
}
c++;
if (c > 400) {
bias = new Vector2(Random.Range(-1f, 1f), Random.Range(-1f,1f)) * biasStrength;
c = 0;
}
Aim(target.position);
RaycastHit2D hit = Physics2D.Raycast(transform.position, target.position - transform.position, 20, whatIsWall);
Debug.DrawLine(transform.position, target.position, Color.black, 1);
if (hit.collider == null) return;
if (hit.collider.gameObject.layer == LayerMask.NameToLayer("Player")) {
if (dist < 11f)
Fire();
}
}
}
================================================
FILE: LD45/Player/Enemy/MeleeEnemy.cs
================================================
using UnityEngine;
public class MeleeEnemy : Actor {
private Transform target;
protected override void Init() {
target = PlayerMovement.Instance.transform;
health += Game.Instance.GetEnemyHealth();
}
private void Update() {
if (target == null) return;
Vector2 tp = target.position;
Vector2 p = transform.position;
float dist = Vector2.Distance(tp, p);
Move(target.position - transform.position);
Aim(target.position);
GenerateDungeon.Instance.objects.Add(gameObject);
}
}
================================================
FILE: LD45/Player/Enemy.meta
================================================
fileFormatVersion: 2
guid: d2a3ae5f977a6ac46862e85c0f71432d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: LD45/Player/PlayerMovement.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using Audio;
using UnityEngine;
public class PlayerMovement : Actor {
public GameObject goldFx;
public static PlayerMovement Instance { get; set; }
private bool invincible;
private int cooldown;
private int pCooldown;
public int soda, helmet, sneaker;
public GameObject currentWeapon;
public GameObject chest;
private int dashDamage = 1;
private int gold;
private Vector2 pushDir;
protected override void Init() {
inventory = new Inventory();
Instance = this;
gun = inventory.GetCurrentGun();
}
private void Update() {
Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Aim(mousePos);
if (pCooldown > 0)
return;
if (dashing)
return;
float x = Input.GetAxis("Horizontal");
float y = Input.GetAxis("Vertical");
Move(new Vector2(x, y));
//Shooting
if (Input.GetMouseButton(0))
Fire();
if (Input.GetKeyDown(KeyCode.Space)) {
Dash(((Vector3) mousePos - transform.position).normalized);
}
if (Input.GetKeyDown(KeyCode.Q)) {
inventory.SwapActive();
}
if (Input.GetKeyDown(KeyCode.E)) {
if (chest != null) {
Chest c = (Chest) chest.GetComponent(typeof(Chest));
if (gold >= c.price) {
c.Open();
gold -= c.price;
}
else {
CameraShake.ShakeOnce(0.15f,1.5f);
AudioManager.Instance.Play("Error");
}
}
else if (currentWeapon != null) {
inventory.PickupGun(currentWeapon);
currentWeapon = null;
}
}
}
private void FixedUpdate() {
if (dashCooldown > 0) dashCooldown--;
if (invincible) {
float a = Mathf.PingPong(Time.time * 10, 0.6f) + 0.3f;
if (a > 0.7f)
sr.color = dColor;
else sr.color = Color.black;
sr.color = new Color(sr.color.r, sr.color.g, sr.color.b, a / 1.3f);
cooldown--;
pCooldown--;
if (cooldown < 1) {
invincible = false;
}
if (pCooldown > 0) {
rb.velocity = pushDir;
return;
}
if (cooldown == 0) sr.color = dColor;
}
if (dashing) {
rb.velocity = (dashDir * dashSpeed) * (1f + (helmet / 4f));
dashC++;
float r = transform.localRotation.eulerAngles.z;
ParticleSystem.MainModule m = ps.main;
m.startRotationZ = 0.01745f * -r;
if (dashC > dashDuration) {
StopDash();
}
}
}
public Rigidbody2D GetRb() {
return rb;
}
public override void Damage(Vector2 dir, int damage) {
if (invincible || dashing) return;
base.Damage(dir, 1);
invincible = true;
cooldown = 80;
pCooldown = 25;
pushDir = -dir;
StopDash();
AudioManager.Instance.Play("PlayerHit");
}
protected override void KillActor() {
base.KillActor();
Destroy(gameObject);
Game.Instance.playing = false;
Game.Instance.PlayerDied();
}
private void OnTriggerEnter2D(Collider2D other) {
if (other.gameObject.layer == LayerMask.NameToLayer("Pickup")) {
if (other.gameObject.CompareTag("Coin")) {
Destroy(other.gameObject);
AudioManager.Instance.Play("Coin");
Instantiate(goldFx, transform.position, Quaternion.identity);
gold++;
}
//Weapons
if (other.gameObject.CompareTag("Gun")) {
currentWeapon = other.gameObject;
}
else if (other.gameObject.CompareTag("Chest"))
chest = other.gameObject;
else if (other.gameObject.CompareTag("Upgrade")) {
((IUpgrade) other.GetComponent(typeof(IUpgrade))).Upgrade();
AudioManager.Instance.Play("Pickup");
}
}
if (other.gameObject.layer == LayerMask.NameToLayer("Enemy")) {
if (dashing) {
Actor e = (Actor) other.GetComponent(typeof(Actor));
e.Damage(rb.velocity, dashDamage + helmet);
CameraShake.ShakeOnce(0.2f, 2.5f);
}
else {
Damage(rb.velocity, dashDamage);
}
}
else if (other.gameObject.layer == LayerMask.NameToLayer("BlockPlayer")) {
if (other.gameObject.CompareTag("Crate")) {
if (dashing)
((Crate) other.gameObject.GetComponent(typeof(Crate))).Break();
}
}
}
private void OnTriggerExit2D(Collider2D other) {
if (other.gameObject.layer == LayerMask.NameToLayer("Pickup")) {
if (other.gameObject.CompareTag("Gun")) {
currentWeapon = null;
}
else if (other.gameObject.CompareTag("Chest"))
chest = null;
}
}
public void Heal() {
if (health == 5) {
AudioManager.Instance.Play("Coin");
gold += 10;
return;
}
health++;
}
public void SetGun(Gun g) {
gun = g;
}
public int GetGold() {
return gold;
}
public int GetHealth() {
return health;
}
public void ResetPlayer() {
inventory.ResetInventory();
soda = 0;
sneaker = 0;
helmet = 0;
gun = null;
health = 5;
gold = 20;
inventory = new Inventory();
}
protected override float GetFireRate() {
int s = soda + 1;
float r = 1.4f / s;
if (r < 0.25f) r = 0.3f;
return r;
}
protected override float GetSpeed() {
float s = speed + (sneaker / 2);
if (s > 20) s = 20;
return s;
}
public Collider2D[] GetColliders() {
return GetComponentsInChildren<Collider2D>();
}
}
================================================
FILE: LD45/UI/PlayerStats.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class PlayerStats : MonoBehaviour {
public TextMeshProUGUI gold;
public Transform hearts;
public SpriteRenderer gun1, gun2;
public static PlayerStats Instance { get; set; }
private void Awake() {
Instance = this;
}
private void Update() {
gold.text = "" + PlayerMovement.Instance.GetGold();
UpdateHearts();
}
private void UpdateHearts() {
int h = PlayerMovement.Instance.GetHealth();
for (int i = 0; i < 5; i++) {
if (i < h)
hearts.GetChild(i).GetChild(0).gameObject.SetActive(true);
else hearts.GetChild(i).GetChild(0).gameObject.SetActive(false);
}
}
}
================================================
FILE: LD45/UI/Settings.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using Audio;
using TMPro;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
public class Settings : MonoBehaviour {
public TextMeshProUGUI graphicsText, musicText, sfxText;
public PostProcessLayer ppl;
private bool graphics, music, sfx;
private void Start() {
graphics = true;
}
public void ChangeGraphics() {
graphics = !graphics;
ppl.enabled = graphics;
graphicsText.text = "Graphics - ";
graphicsText.text += graphics ? "Fancy" : "Performance";
}
public void ChangeMusic() {
bool s = AudioManager.Instance.muteMusic;
if (s) musicText.text = "Music - off";
else musicText.text = "Music - on";
}
public void ChangeSounds() {
bool s = AudioManager.Instance.muted;
if (s) sfxText.text = "Sounds - off";
else sfxText.text = "Sounds - on";
}
}
================================================
FILE: LD45/UI/Timer.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class Timer : MonoBehaviour {
public TextMeshProUGUI text, status;
private float timer = 0;
public static Timer Instance { get; set; }
private void Awake() {
Instance = this;
}
public void StartTimer() {
timer = 0;
}
void Update() {
if (!Game.Instance.playing) return;
timer += Time.deltaTime;
string minutes = Mathf.Floor(timer / 60).ToString("00");
string seconds = Mathf.Floor(timer % 60).ToString("00");
text.text = string.Format("{0}:{1}", minutes, seconds);
status.text = StatusText(Mathf.Floor(timer / 60));
}
private string StatusText(float f) {
if (f < 2) return "very easy";
if (f < 4) return "easy";
if (f < 8) return "medium";
if (f < 12) return "hard";
if (f < 16) return "very hard";
if (f < 20) return "impossible";
if (f < 25) return "oh shit";
if (f < 30) return "very oh shit";
return "f";
}
public int GetMinutes() {
return (int) Mathf.Floor(timer / 60);
}
}
================================================
FILE: LD45/Upgrades/Heart.cs
================================================
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Heart : MonoBehaviour, IUpgrade {
private bool upgraded;
public GameObject pickup;
public void Upgrade() {
if (upgraded) return;
upgraded = true;
PlayerMovement.Instance.Heal();
Instantiate(pickup, transform.position, Quaternion.identity);
Destroy(gameObject);
}
}
================================================
FILE: LD45/Upgrades/Helmet.cs
================================================
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class Helmet : MonoBehaviour, IUpgrade {
//please dont look at my shitty redundant code LOL
private bool upgraded;
public GameObject pickup;
public GameObject text;
public void Upgrade() {
if (upgraded) return;
upgraded = true;
PlayerMovement.Instance.helmet++;
Instantiate(pickup, transform.position, Quaternion.identity);
Destroy(gameObject);
Instantiate(text, transform.position, Quaternion.identity).GetComponentInChildren<TextMeshProUGUI>().text = "+dash";
}
}
================================================
FILE: LD45/Upgrades/IUpgrade.cs
================================================
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IUpgrade {
void Upgrade();
}
================================================
FILE: LD45/Upgrades/Sneakers.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class Sneakers : MonoBehaviour, IUpgrade {
private bool upgraded;
public GameObject pickup;
public GameObject text;
public void Upgrade() {
if (upgraded) return;
upgraded = true;
PlayerMovement.Instance.sneaker++;
Instantiate(pickup, transform.position, Quaternion.identity);
Destroy(gameObject);
Instantiate(text, transform.position, Quaternion.identity).GetComponentInChildren<TextMeshProUGUI>().text = "+speed";
}
}
================================================
FILE: LD45/Upgrades/Soda.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class Soda : MonoBehaviour, IUpgrade {
private bool upgraded;
public GameObject pickup;
public GameObject text;
public void Upgrade() {
if (upgraded) return;
upgraded = true;
PlayerMovement.Instance.soda++;
Instantiate(pickup, transform.position, Quaternion.identity);
Destroy(gameObject);
Instantiate(text, transform.position, Quaternion.identity).GetComponentInChildren<TextMeshProUGUI>().text = "+fire rate";
}
}
================================================
FILE: LD45/Weapons/Bullet.cs
================================================
using System;
using UnityEngine;
public class Bullet : MonoBehaviour {
public GameObject explosion;
private int damage = 1;
private void OnCollisionEnter2D(Collision2D other) {
if (other.gameObject.layer == LayerMask.NameToLayer("BlockPlayer"))
ExplodeBullet();
else {
Actor a = (Actor) other.gameObject.GetComponent(typeof(Actor));
a.Damage(-GetComponent<Rigidbody2D>().velocity, damage);
ExplodeBullet();
}
}
private void ExplodeBullet() {
Instantiate(explosion, transform.position, Quaternion.identity);
Destroy(gameObject);
}
public void SetDamage(int d) {
damage = d;
}
}
================================================
FILE: LD45/Weapons/Chest.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using Audio;
using UnityEngine;
using Random = UnityEngine.Random;
public class Chest : MonoBehaviour {
public GameObject[] weapons;
private Collider2D[] playerColliders;
private Collider2D myCollider;
public bool e;
public int price;
public void Open() {
playerColliders = PlayerMovement.Instance.GetColliders();
print(playerColliders);
GameObject weapon = SelectWeapon(e);
GameObject w = Instantiate(weapon, transform.position, transform.rotation);
Vector2 dir = (transform.position - PlayerMovement.Instance.transform.position).normalized;
w.GetComponent<Rigidbody2D>().AddForce((dir * 3000) + new Vector2(Random.Range(-4000, 4000), Random.Range(-4000, 4000)));
w.GetComponent<Rigidbody2D>().AddTorque(Random.Range(-2000,2000));
CameraShake.ShakeOnce(0.3f, 2f);
AudioManager.Instance.Play("Pickup");
myCollider = w.GetComponent<Collider2D>();
RemoveCollision();
gameObject.SetActive(false);
GenerateDungeon.Instance.objects.Add(w);
}
private void RemoveCollision() {
for (int i = 0; i < playerColliders.Length; i++) {
Physics2D.IgnoreCollision(playerColliders[i], myCollider, true);
}
Invoke(nameof(ResumeCollision), 0.8f);
}
private void ResumeCollision() {
print("start colliding again");
for (int i = 0; i < playerColliders.Length; i++) {
Physics2D.IgnoreCollision(playerColliders[i], myCollider, false);
}
}
private GameObject SelectWeapon(bool e) {
if (e) {
return weapons[Random.Range(0, weapons.Length)];
}
int u = Mathf.FloorToInt(0 + (weapons.Length) * Mathf.Pow(Random.Range(0f, 1f), 2));
int sum = 0;
return weapons[u];
}
}
================================================
FILE: LD45/Weapons/Gun.cs
================================================
using UnityEngine;
public class Gun {
private float fireRate;
private float bullets;
private float spread;
private float speed;
private int damage;
private string description;
public Gun(float fireRate, float bullets, float spread, float speed, int damage, string desc) {
this.fireRate = fireRate;
this.bullets = bullets;
this.spread = spread;
this.speed = speed;
this.description = desc;
this.damage = damage;
}
public float GetFireRate() {
return fireRate;
}
public float GetBullets() {
return bullets;
}
public float GetSpread() {
return spread;
}
public float GetSpeed() {
return speed;
}
public string GetDescription() {
return description;
}
public int GetDamage() {
return damage;
}
}
================================================
FILE: LD45/Weapons/GunContainer.cs
================================================
using System;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
public class GunContainer : MonoBehaviour{
public static readonly Gun rustyPistol = new Gun(0.35f, 1, 0.15f, 9f, 1, "Rusty Pistol");
public static readonly Gun shinyPistol = new Gun(0.3f, 1, 0.08f, 12f, 1, "Shiny Pistol");
public static readonly Gun dualPistol = new Gun(0.3f, 2, 0.2f, 11f, 1, "Dual Pistol");
public static readonly Gun revolver = new Gun(0.4f, 1, 0.05f, 14f, 2, "Revolver");
public static readonly Gun smallShotgun = new Gun(0.5f, 5, 0.35f, 12f, 1, "Small Shotgun");
public static readonly Gun shotgun = new Gun(0.45f, 6, 0.25f, 14f, 1, "Shotgun");
public static readonly Gun sawedoffShotgun = new Gun(0.55f, 8, 0.5f, 14f, 1, "Sawed-off Shotgun");
public static readonly Gun rifle = new Gun(0.1f, 1, 0.15f, 15f, 1, "Rifle");
public static readonly Gun doubleRifle = new Gun(0.12f, 2, 0.45f, 15f, 1, "Double Rifle");
public static readonly Gun coolRifle = new Gun(0.15f, 1, 0.13f, 15f, 2, "Cooler Rifle");
public static readonly Gun sniper = new Gun(0.8f, 1, 0.0f, 25f, 10, "Sniper");
public static List<Gun> guns;
private void Start() {
guns = new List<Gun>();
guns.Add(rustyPistol);
guns.Add(shinyPistol);
guns.Add(dualPistol);
guns.Add(revolver);
guns.Add(smallShotgun);
guns.Add(shotgun);
guns.Add(sawedoffShotgun);
guns.Add(rifle);
guns.Add(doubleRifle);
guns.Add(coolRifle);
guns.Add(sniper);
}
public static Gun GetGun(int n) {
return guns[n];
}
public static Gun GetRandomGun() {
return guns[Random.Range(0, guns.Count)];
}
}
================================================
FILE: LD45/Weapons/Inventory.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using Audio;
using UnityEngine;
public class Inventory : MonoBehaviour {
private Gun gun1, gun2;
private int activeGun = 0;
public void PickupGun(GameObject g) {
if (g == null) return;
Weapon w = (Weapon) g.GetComponent(typeof(Weapon));
if (w.pickedUp) return;
w.pickedUp = true;
AudioManager.Instance.Play("PickupGun");
g.SetActive(false);
if (gun1 == null) {
gun1 = ((Weapon) g.GetComponent(typeof(Weapon))).GetGun();
PlayerStats.Instance.gun1.sprite = g.GetComponent<SpriteRenderer>().sprite;
}
else if (gun2 == null) {
gun2 = ((Weapon) g.GetComponent(typeof(Weapon))).GetGun();
PlayerStats.Instance.gun2.sprite = g.GetComponent<SpriteRenderer>().sprite;
}
else if (activeGun == 0) {
gun1 = ((Weapon) g.GetComponent(typeof(Weapon))).GetGun();
PlayerStats.Instance.gun1.sprite = g.GetComponent<SpriteRenderer>().sprite;
}
else {
gun2 = ((Weapon) g.GetComponent(typeof(Weapon))).GetGun();
PlayerStats.Instance.gun2.sprite = g.GetComponent<SpriteRenderer>().sprite;
}
PlayerMovement.Instance.SetGun(GetCurrentGun());
}
public Gun GetCurrentGun() {
if (activeGun == 0) {
return gun1;
}
return gun2;
}
public void SwapActive() {
AudioManager.Instance.Play("PickupGun");
if (activeGun == 0) {
activeGun = 1;
PlayerStats.Instance.gun1.transform.GetChild(0).GetComponent<SpriteRenderer>().color = Color.gray;
PlayerStats.Instance.gun2.transform.GetChild(0).GetComponent<SpriteRenderer>().color = Color.white;
}
else {
activeGun = 0;
PlayerStats.Instance.gun2.transform.GetChild(0).GetComponent<SpriteRenderer>().color = Color.gray;
PlayerStats.Instance.gun1.transform.GetChild(0).GetComponent<SpriteRenderer>().color = Color.white;
}
PlayerMovement.Instance.SetGun(GetCurrentGun());
}
public void ResetInventory() {
gun1 = null;
gun2 = null;
activeGun = 0;
}
}
================================================
FILE: LD45/Weapons/Weapon.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Weapon : MonoBehaviour {
private Gun gun;
public int gunNr;
public bool pickedUp;
private void Start() {
gun = GunContainer.GetGun(gunNr);
}
public Gun GetGun() {
return gun;
}
}
================================================
FILE: README.md
================================================
# LudumDare45
gitextract_g4xbrcvp/ ├── LD45/ │ ├── Audio/ │ │ ├── AudioManager.cs │ │ └── Sound.cs │ ├── Board/ │ │ ├── GenerateDungeon.cs │ │ ├── SpawnEnemy.cs │ │ ├── SpawnProps.cs │ │ └── StartRoom.cs │ ├── Camera/ │ │ ├── CameraMovement.cs │ │ └── CameraShake.cs │ ├── Game/ │ │ └── Game.cs │ ├── Other/ │ │ ├── Crate.cs │ │ ├── Enlighten.cs │ │ ├── Floor.cs │ │ ├── Goal.cs │ │ ├── Laser.cs │ │ ├── Minimap.cs │ │ └── Remove.cs │ ├── Player/ │ │ ├── Actor.cs │ │ ├── Enemy/ │ │ │ ├── Enemy.cs │ │ │ └── MeleeEnemy.cs │ │ ├── Enemy.meta │ │ └── PlayerMovement.cs │ ├── UI/ │ │ ├── PlayerStats.cs │ │ ├── Settings.cs │ │ └── Timer.cs │ ├── Upgrades/ │ │ ├── Heart.cs │ │ ├── Helmet.cs │ │ ├── IUpgrade.cs │ │ ├── Sneakers.cs │ │ └── Soda.cs │ └── Weapons/ │ ├── Bullet.cs │ ├── Chest.cs │ ├── Gun.cs │ ├── GunContainer.cs │ ├── Inventory.cs │ └── Weapon.cs └── README.md
SYMBOL INDEX (176 symbols across 34 files)
FILE: LD45/Audio/AudioManager.cs
class AudioManager (line 5) | public class AudioManager : MonoBehaviour {
method Awake (line 15) | void Awake () {
method MuteSounds (line 32) | public void MuteSounds() {
method MuteMusic (line 36) | public void MuteMusic() {
method SetVolume (line 49) | public void SetVolume(float v) {
method UnmuteMusic (line 58) | public void UnmuteMusic() {
method Play (line 67) | public void Play(string n) {
method Stop (line 77) | public void Stop(string n) {
FILE: LD45/Audio/Sound.cs
class Sound (line 4) | [System.Serializable]
FILE: LD45/Board/GenerateDungeon.cs
class GenerateDungeon (line 6) | public class GenerateDungeon : MonoBehaviour {
method Awake (line 28) | private void Awake() {
method DeleteDungeon (line 33) | public void DeleteDungeon() {
method GenerateNewDungeon (line 40) | public void GenerateNewDungeon() {
method FindChests (line 74) | private void FindChests() {
method ShowAvailable (line 108) | private void ShowAvailable() {
method FindSpawns (line 114) | private void FindSpawns() {
method FindRandomLeaf (line 125) | private void FindRandomLeaf() {
method GenerateNewRoom (line 129) | private bool GenerateNewRoom() {
method hasNeighbours (line 161) | private bool hasNeighbours(Vector2 pos) {
method nNeighbours (line 173) | private int nNeighbours(Vector2 pos) {
method markRoom (line 184) | private void markRoom(Tuple<Vector2, Vector2> newRoom, int mark) {
method ShowRooms (line 198) | private void ShowRooms() {
method GetSpawnPos (line 230) | public Vector2 GetSpawnPos() {
FILE: LD45/Board/SpawnEnemy.cs
class SpawnEnemy (line 7) | public class SpawnEnemy : MonoBehaviour {
method Start (line 12) | private void Start() {
method Spawn (line 18) | private void Spawn() {
FILE: LD45/Board/SpawnProps.cs
class SpawnProps (line 5) | public class SpawnProps : MonoBehaviour {
method Start (line 14) | void Start() {
FILE: LD45/Board/StartRoom.cs
class StartRoom (line 8) | public class StartRoom : MonoBehaviour {
method Awake (line 21) | private void Awake() {
method OnTriggerEnter2D (line 26) | private void OnTriggerEnter2D(Collider2D other) {
method FixedUpdate (line 41) | private void FixedUpdate() {
method CheckEnemyList (line 56) | private void CheckEnemyList() {
method SpawnEnemies (line 63) | private void SpawnEnemies() {
method GetCheckReady (line 73) | private void GetCheckReady() {
method SpawnOneEnemy (line 77) | private void SpawnOneEnemy() {
method SelectEnemy (line 83) | private GameObject SelectEnemy() {
method FinishRoom (line 87) | public void FinishRoom() {
FILE: LD45/Camera/CameraMovement.cs
class CameraMovement (line 3) | public class CameraMovement : MonoBehaviour {
method Awake (line 21) | private void Awake() {
method FixedUpdate (line 26) | void FixedUpdate () {
method SetPlayer (line 53) | public void SetPlayer(Transform t) {
method StartRound (line 57) | public void StartRound() {
method SetRoom (line 62) | public void SetRoom(Transform pos) {
FILE: LD45/Camera/CameraShake.cs
class CameraShake (line 4) | public class CameraShake : MonoBehaviour {
method Awake (line 16) | void Awake() {
method ShakeOnce (line 24) | public static void ShakeOnce(float lenght, float strength) {
method Update (line 29) | void Update() {
FILE: LD45/Game/Game.cs
class Game (line 8) | public class Game : MonoBehaviour {
method Awake (line 23) | private void Awake() {
method NextFloor (line 27) | public void NextFloor() {
method StartGame (line 36) | public void StartGame() {
method GetFirerateMultiplier (line 49) | public float GetFirerateMultiplier() {
method GetSpeedMultiplier (line 57) | public float GetSpeedMultiplier() {
method GetEnemyAmount (line 64) | public int GetEnemyAmount() {
method GetWaveAmount (line 75) | public int GetWaveAmount() {
method GetEnemy (line 83) | public GameObject GetEnemy() {
method PlayerDied (line 94) | public void PlayerDied() {
method GetEnemyHealth (line 103) | public int GetEnemyHealth() {
method ExitGame (line 108) | public void ExitGame() {
FILE: LD45/Other/Crate.cs
class Crate (line 8) | public class Crate : MonoBehaviour {
method Start (line 18) | private void Start() {
method Break (line 22) | public void Break() {
method RemoveCollision (line 40) | private void RemoveCollision() {
method ResumeCollision (line 47) | private void ResumeCollision() {
method SelectWeapon (line 54) | private GameObject SelectWeapon(bool e) {
FILE: LD45/Other/Enlighten.cs
class Enlighten (line 6) | public class Enlighten : MonoBehaviour
method OnTriggerEnter2D (line 8) | private void OnTriggerEnter2D(Collider2D other) {
FILE: LD45/Other/Floor.cs
class Floor (line 7) | public class Floor : MonoBehaviour {
method Start (line 12) | private void Start() {
FILE: LD45/Other/Goal.cs
class Goal (line 6) | public class Goal : MonoBehaviour {
method OnTriggerEnter2D (line 8) | private void OnTriggerEnter2D(Collider2D other) {
FILE: LD45/Other/Laser.cs
class Laser (line 5) | public class Laser : MonoBehaviour {
method Start (line 9) | void Start() {
method Update (line 16) | void Update() {
FILE: LD45/Other/Minimap.cs
class Minimap (line 5) | public class Minimap : MonoBehaviour {
method Awake (line 19) | private void Awake() {
method LoadMap (line 32) | public void LoadMap() {
method Update (line 57) | private void Update() {
FILE: LD45/Other/Remove.cs
class Remove (line 5) | public class Remove : MonoBehaviour {
method Start (line 7) | void Start() {
method KillSelf (line 11) | private void KillSelf() {
FILE: LD45/Player/Actor.cs
class Actor (line 7) | public class Actor : MonoBehaviour {
method Init (line 35) | protected virtual void Init() { }
method Awake (line 36) | private void Awake() {
method Aim (line 45) | protected void Aim(Vector3 target) {
method Move (line 51) | protected void Move(Vector2 dir) {
method GetSpeed (line 60) | protected virtual float GetSpeed() {
method Dash (line 64) | protected void Dash(Vector2 dir) {
method StopDash (line 80) | protected void StopDash() {
method KillActor (line 87) | protected virtual void KillActor() {
method Damage (line 104) | public virtual void Damage(Vector2 dir, int damage) {
method ResetColor (line 116) | private void ResetColor() {
method Fire (line 120) | protected void Fire() {
method FireCooldown (line 151) | protected void FireCooldown() {
method OnCollisionEnter2D (line 155) | private void OnCollisionEnter2D(Collision2D other) {
method GetSpeedMultiplier (line 164) | protected float GetSpeedMultiplier() {
method GetFirerateMultiplier (line 170) | protected float GetFirerateMultiplier() {
method GetFireRate (line 176) | protected virtual float GetFireRate() {
FILE: LD45/Player/Enemy/Enemy.cs
class Enemy (line 7) | public class Enemy : Actor {
method Init (line 20) | protected override void Init() {
method Update (line 33) | private void Update() {
FILE: LD45/Player/Enemy/MeleeEnemy.cs
class MeleeEnemy (line 3) | public class MeleeEnemy : Actor {
method Init (line 7) | protected override void Init() {
method Update (line 12) | private void Update() {
FILE: LD45/Player/PlayerMovement.cs
class PlayerMovement (line 7) | public class PlayerMovement : Actor {
method Init (line 25) | protected override void Init() {
method Update (line 31) | private void Update() {
method FixedUpdate (line 75) | private void FixedUpdate() {
method GetRb (line 112) | public Rigidbody2D GetRb() {
method Damage (line 116) | public override void Damage(Vector2 dir, int damage) {
method KillActor (line 127) | protected override void KillActor() {
method OnTriggerEnter2D (line 134) | private void OnTriggerEnter2D(Collider2D other) {
method OnTriggerExit2D (line 173) | private void OnTriggerExit2D(Collider2D other) {
method Heal (line 183) | public void Heal() {
method SetGun (line 192) | public void SetGun(Gun g) {
method GetGold (line 196) | public int GetGold() {
method GetHealth (line 200) | public int GetHealth() {
method ResetPlayer (line 204) | public void ResetPlayer() {
method GetFireRate (line 215) | protected override float GetFireRate() {
method GetSpeed (line 222) | protected override float GetSpeed() {
method GetColliders (line 228) | public Collider2D[] GetColliders() {
FILE: LD45/UI/PlayerStats.cs
class PlayerStats (line 7) | public class PlayerStats : MonoBehaviour {
method Awake (line 15) | private void Awake() {
method Update (line 19) | private void Update() {
method UpdateHearts (line 24) | private void UpdateHearts() {
FILE: LD45/UI/Settings.cs
class Settings (line 9) | public class Settings : MonoBehaviour {
method Start (line 15) | private void Start() {
method ChangeGraphics (line 19) | public void ChangeGraphics() {
method ChangeMusic (line 27) | public void ChangeMusic() {
method ChangeSounds (line 33) | public void ChangeSounds() {
FILE: LD45/UI/Timer.cs
class Timer (line 7) | public class Timer : MonoBehaviour {
method Awake (line 14) | private void Awake() {
method StartTimer (line 18) | public void StartTimer() {
method Update (line 22) | void Update() {
method StatusText (line 34) | private string StatusText(float f) {
method GetMinutes (line 46) | public int GetMinutes() {
FILE: LD45/Upgrades/Heart.cs
class Heart (line 5) | public class Heart : MonoBehaviour, IUpgrade {
method Upgrade (line 9) | public void Upgrade() {
FILE: LD45/Upgrades/Helmet.cs
class Helmet (line 6) | public class Helmet : MonoBehaviour, IUpgrade {
method Upgrade (line 12) | public void Upgrade() {
FILE: LD45/Upgrades/IUpgrade.cs
type IUpgrade (line 5) | public interface IUpgrade {
method Upgrade (line 7) | void Upgrade();
FILE: LD45/Upgrades/Sneakers.cs
class Sneakers (line 7) | public class Sneakers : MonoBehaviour, IUpgrade {
method Upgrade (line 14) | public void Upgrade() {
FILE: LD45/Upgrades/Soda.cs
class Soda (line 7) | public class Soda : MonoBehaviour, IUpgrade {
method Upgrade (line 13) | public void Upgrade() {
FILE: LD45/Weapons/Bullet.cs
class Bullet (line 4) | public class Bullet : MonoBehaviour {
method OnCollisionEnter2D (line 9) | private void OnCollisionEnter2D(Collision2D other) {
method ExplodeBullet (line 19) | private void ExplodeBullet() {
method SetDamage (line 24) | public void SetDamage(int d) {
FILE: LD45/Weapons/Chest.cs
class Chest (line 8) | public class Chest : MonoBehaviour {
method Open (line 16) | public void Open() {
method RemoveCollision (line 32) | private void RemoveCollision() {
method ResumeCollision (line 39) | private void ResumeCollision() {
method SelectWeapon (line 46) | private GameObject SelectWeapon(bool e) {
FILE: LD45/Weapons/Gun.cs
class Gun (line 3) | public class Gun {
method Gun (line 12) | public Gun(float fireRate, float bullets, float spread, float speed, i...
method GetFireRate (line 21) | public float GetFireRate() {
method GetBullets (line 25) | public float GetBullets() {
method GetSpread (line 29) | public float GetSpread() {
method GetSpeed (line 33) | public float GetSpeed() {
method GetDescription (line 37) | public string GetDescription() {
method GetDamage (line 41) | public int GetDamage() {
FILE: LD45/Weapons/GunContainer.cs
class GunContainer (line 7) | public class GunContainer : MonoBehaviour{
method Start (line 25) | private void Start() {
method GetGun (line 40) | public static Gun GetGun(int n) {
method GetRandomGun (line 44) | public static Gun GetRandomGun() {
FILE: LD45/Weapons/Inventory.cs
class Inventory (line 7) | public class Inventory : MonoBehaviour {
method PickupGun (line 12) | public void PickupGun(GameObject g) {
method GetCurrentGun (line 39) | public Gun GetCurrentGun() {
method SwapActive (line 46) | public void SwapActive() {
method ResetInventory (line 62) | public void ResetInventory() {
FILE: LD45/Weapons/Weapon.cs
class Weapon (line 6) | public class Weapon : MonoBehaviour {
method Start (line 12) | private void Start() {
method GetGun (line 16) | public Gun GetGun() {
Condensed preview — 36 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (63K chars).
[
{
"path": "LD45/Audio/AudioManager.cs",
"chars": 1586,
"preview": "using UnityEngine;\r\nusing Random = UnityEngine.Random;\r\n\r\nnamespace Audio {\r\n\tpublic class AudioManager : MonoBehaviour"
},
{
"path": "LD45/Audio/Sound.cs",
"chars": 420,
"preview": "using UnityEngine;\r\n\r\nnamespace Audio {\r\n [System.Serializable]\r\n public class Sound {\r\n \r\n public string "
},
{
"path": "LD45/Board/GenerateDungeon.cs",
"chars": 8639,
"preview": "using System;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\nusing Random = UnityEngine.Random;\r\n\r\npublic clas"
},
{
"path": "LD45/Board/SpawnEnemy.cs",
"chars": 807,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\nusing Random = UnityEn"
},
{
"path": "LD45/Board/SpawnProps.cs",
"chars": 1073,
"preview": "using System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\n\r\npublic class SpawnProps : MonoBehav"
},
{
"path": "LD45/Board/StartRoom.cs",
"chars": 2727,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing Audio;\r\nusing UnityEngine;\r\nusing Ra"
},
{
"path": "LD45/Camera/CameraMovement.cs",
"chars": 1961,
"preview": "using System;\r\nusing UnityEngine;\r\npublic class CameraMovement : MonoBehaviour {\r\n\r\n\tpublic Transform player;\r\n\r\n\tpriva"
},
{
"path": "LD45/Camera/CameraShake.cs",
"chars": 1140,
"preview": "using UnityEngine;\r\nusing Random = UnityEngine.Random;\r\n\r\npublic class CameraShake : MonoBehaviour {\r\n public Transf"
},
{
"path": "LD45/Game/Game.cs",
"chars": 3158,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing TMPro;\r\nusing UnityEngine;\r\nusing Ra"
},
{
"path": "LD45/Other/Crate.cs",
"chars": 2189,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing Audio;\r\nusing UnityEngine;\r\nusing Ra"
},
{
"path": "LD45/Other/Enlighten.cs",
"chars": 314,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\n\r\npublic class Enlight"
},
{
"path": "LD45/Other/Floor.cs",
"chars": 540,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing TMPro;\r\nusing UnityEngine;\r\n\r\npublic"
},
{
"path": "LD45/Other/Goal.cs",
"chars": 384,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\n\r\npublic class Goal : "
},
{
"path": "LD45/Other/Laser.cs",
"chars": 582,
"preview": "using System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\n\r\npublic class Laser : MonoBehaviour "
},
{
"path": "LD45/Other/Minimap.cs",
"chars": 2246,
"preview": "using System;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\n\r\npublic class Minimap : MonoBehaviour {\r\n\r\n p"
},
{
"path": "LD45/Other/Remove.cs",
"chars": 324,
"preview": "using System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\n\r\npublic class Remove : MonoBehaviour"
},
{
"path": "LD45/Player/Actor.cs",
"chars": 5643,
"preview": "using System;\r\nusing System.Collections.Generic;\r\nusing Audio;\r\nusing UnityEngine;\r\nusing Random = UnityEngine.Random;\r"
},
{
"path": "LD45/Player/Enemy/Enemy.cs",
"chars": 2039,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\nusing Random = UnityEn"
},
{
"path": "LD45/Player/Enemy/MeleeEnemy.cs",
"chars": 602,
"preview": "using UnityEngine;\r\n\r\npublic class MeleeEnemy : Actor {\r\n\r\n private Transform target;\r\n\r\n protected override void"
},
{
"path": "LD45/Player/Enemy.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: d2a3ae5f977a6ac46862e85c0f71432d\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "LD45/Player/PlayerMovement.cs",
"chars": 6621,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing Audio;\r\nusing UnityEngine;\r\n\r\npublic"
},
{
"path": "LD45/UI/PlayerStats.cs",
"chars": 845,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing TMPro;\r\nusing UnityEngine;\r\n\r\npublic"
},
{
"path": "LD45/UI/Settings.cs",
"chars": 1008,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing Audio;\r\nusing TMPro;\r\nusing UnityEng"
},
{
"path": "LD45/UI/Timer.cs",
"chars": 1264,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing TMPro;\r\nusing UnityEngine;\r\n\r\npublic"
},
{
"path": "LD45/Upgrades/Heart.cs",
"chars": 436,
"preview": "using System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\n\r\npublic class Heart : MonoBehaviour,"
},
{
"path": "LD45/Upgrades/Helmet.cs",
"chars": 664,
"preview": "using System.Collections;\r\nusing System.Collections.Generic;\r\nusing TMPro;\r\nusing UnityEngine;\r\n\r\npublic class Helmet :"
},
{
"path": "LD45/Upgrades/IUpgrade.cs",
"chars": 153,
"preview": "using System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\n\r\npublic interface IUpgrade {\r\n \r"
},
{
"path": "LD45/Upgrades/Sneakers.cs",
"chars": 633,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing TMPro;\r\nusing UnityEngine;\r\n\r\npublic"
},
{
"path": "LD45/Upgrades/Soda.cs",
"chars": 630,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing TMPro;\r\nusing UnityEngine;\r\n\r\npublic"
},
{
"path": "LD45/Weapons/Bullet.cs",
"chars": 742,
"preview": "using System;\r\nusing UnityEngine;\r\n\r\npublic class Bullet : MonoBehaviour {\r\n\r\n public GameObject explosion;\r\n pri"
},
{
"path": "LD45/Weapons/Chest.cs",
"chars": 1971,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing Audio;\r\nusing UnityEngine;\r\nusing Ra"
},
{
"path": "LD45/Weapons/Gun.cs",
"chars": 928,
"preview": "using UnityEngine;\r\n\r\npublic class Gun {\r\n\r\n private float fireRate;\r\n private float bullets;\r\n private float "
},
{
"path": "LD45/Weapons/GunContainer.cs",
"chars": 1802,
"preview": "\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\nusing Random = UnityEngine.Random;\r\n\r\npublic cl"
},
{
"path": "LD45/Weapons/Inventory.cs",
"chars": 2354,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing Audio;\r\nusing UnityEngine;\r\n\r\npublic"
},
{
"path": "LD45/Weapons/Weapon.cs",
"chars": 353,
"preview": "using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\n\r\npublic class Weapon "
},
{
"path": "README.md",
"chars": 13,
"preview": "# LudumDare45"
}
]
About this extraction
This page contains the full source code of the DaniDevy/LudumDare45 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 36 files (55.6 KB), approximately 14.2k tokens, and a symbol index with 176 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.