This commit is contained in:
Gerard Gascón 2025-04-24 17:02:43 +02:00
commit fca6784fe7
571 changed files with 84105 additions and 0 deletions

View file

@ -0,0 +1,71 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Grid : MonoBehaviour{
public bool empty = false;
[HideInInspector] public int index;
[System.Serializable] public enum Enemy { Oso, Driada, Loca }
public Enemy enemy;
[Space]
public bool isBoss = false;
public bool unlocked;
public bool connected;
[Space]
public Grid upGrid;
public Grid downGrid;
public Grid leftGrid;
public Grid rightGrid;
[Space]
public Grid upPathToUnlock;
public Grid downPathToUnlock;
public Grid leftPathToUnlock;
public Grid rightPathToUnlock;
BoxCollider2D boxCollider;
void Awake(){
float range = Random.Range(0f, 300f);
if(range < 100f){
enemy = Enemy.Oso;
}else if(range >= 100f && range < 200f){
enemy = Enemy.Driada;
}else{
enemy = Enemy.Loca;
}
boxCollider = GetComponent<BoxCollider2D>();
}
public void UpdateEnemies(Enemy enemyType){
enemy = enemyType;
}
public void Connect(){
}
void Update(){
if (unlocked){
boxCollider.enabled = false;
if(upPathToUnlock != null){
upGrid = upPathToUnlock;
}
if (downPathToUnlock != null){
downGrid = downPathToUnlock;
}
if (leftPathToUnlock != null){
leftGrid = leftPathToUnlock;
}
if (rightPathToUnlock != null){
rightGrid = rightPathToUnlock;
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5f8da0b023926474a882cd92e8ef20b0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Level : MonoBehaviour{
public Grid[] grids;
public static Level instance;
void Awake(){
instance = this;
}
void Start(){
if(GameMaster.instance.grids != null){
for (int i = 0; i < grids.Length; i++){
grids[i].unlocked = GameMaster.instance.grids[i];
grids[i].enemy = (Grid.Enemy)GameMaster.instance.enemyType[i];
}
}else{
GameMaster.instance.grids = new Dictionary<int, bool>();
GameMaster.instance.enemyType = new Dictionary<int, int>();
for (int i = 0; i < grids.Length; i++){
GameMaster.instance.grids.Add(i, grids[i].unlocked);
GameMaster.instance.enemyType.Add(i, (int)grids[i].enemy);
}
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5eb9447b1990b7f4c8a6e3cc6762fa70
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: