added spawns for slimes, boss slime added. blocker for final area added + key to unlock

This commit is contained in:
2022-04-25 15:29:04 +03:00
parent 3813586b4c
commit b51388d292
39 changed files with 4826 additions and 1333 deletions

View File

@@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SlimeSpawner : MonoBehaviour
{
[SerializeField]
private List<GameObject> slimeTypes;
[SerializeField]
private List<Transform> spawnLocations;
[SerializeField]
private int maxAmount = 5;
// Start is called before the first frame update
void Start()
{
InvokeRepeating("SpawnSlime", 5, 5);
}
public void SpawnSlime()
{
int alive = GameObject.FindGameObjectsWithTag("Slime").Length;
if (alive == maxAmount)
{
// Max amount of slimes reached.
Debug.LogWarning("Maximum reached");
}
else
{
float slimeRandom = Random.Range(0, slimeTypes.Count);
float spawnRandom = Random.Range(0, spawnLocations.Count);
Instantiate(slimeTypes[Mathf.RoundToInt(slimeRandom)], spawnLocations[Mathf.RoundToInt(spawnRandom)].position, Quaternion.identity);
}
}
}

View File

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