Slimes can now cross tile boundaries.

This commit is contained in:
finnchen123
2026-02-08 20:31:04 +01:00
parent 53f775dfe7
commit f98c32d558
4 changed files with 19 additions and 15 deletions

View File

@@ -68,15 +68,19 @@ namespace Assets.Scripts.InteractableObjects
{
if (col.name.Contains("_") && col.gameObject == gameObject.transform.parent.gameObject)
{
gameObject.GetComponent<Rigidbody>().AddForce(gameObject.GetComponent<Rigidbody>().linearVelocity * -2, ForceMode.Impulse);
col.gameObject.GetComponent<Tile>().aliveEnemies.Remove(gameObject);
}
}
public void HandleAttack()
void OnTriggerEnter(Collider col)
{
//TODO: Force Fight start
if (col.name.Contains("_") && col.gameObject != gameObject.transform.parent.gameObject)
{
col.gameObject.GetComponent<Tile>().aliveEnemies.Add(gameObject);
gameObject.transform.SetParent(col.gameObject.transform);
}
}
public void handleFollow(bool isFollowing)
{
followsPlayer = isFollowing;

View File

@@ -13,7 +13,7 @@ public class Tile : MonoBehaviour
System.Random rand = new System.Random();
TileType tiletype;
GameObject contentGenerator;
List<GameObject> aliveEnemies = new List<GameObject>();
public List<GameObject> aliveEnemies = new List<GameObject>();
public void generateTile(Vector3 pos, TileType type)
{