Ropasci-Forest/Assets/Scripts/Overworld/Grid.cs
Gerard Gascón fca6784fe7 init
2025-04-24 17:02:43 +02:00

71 lines
1.6 KiB
C#

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;
}
}
}
}