Merge branch 'soulaha' into dev

This commit is contained in:
Soulaha Balde 2022-04-03 17:02:25 -04:00
commit c718c9e595
6 changed files with 51 additions and 13 deletions

View File

@ -208,10 +208,6 @@ PrefabInstance:
propertyPath: m_Name
value: SceneStuff
objectReference: {fileID: 0}
- target: {fileID: 8365024802335227869, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3}
propertyPath: orthographic size
value: 10.5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3}
--- !u!4 &720678398 stripped

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 9145057a34a60964eb8cc79037227889
guid: 8b8f40b774485ae4588cba2c53f8ac9d
DefaultImporter:
externalObjects: {}
userData:

View File

@ -120,7 +120,6 @@ public class AIEntity : Entity {
RaycastHit2D hit = Physics2D.Raycast(transform.position, direction, attackRange, (1 << LayerMask.NameToLayer("Safezone")));//Layer 6 is safeZone
Physics2D.queriesHitTriggers = true;
if(!(hit.collider is null)){ //We have hit the safe zone
//Debug.Log("hit");
isAvoiding = true;
Vector3 avoidDir = Vector3.zero;
//Between top and bottom

View File

@ -33,6 +33,7 @@ public class Arena : MonoBehaviour {
public Transform graveyard { get; private set; } = null!;
SafeZone safeZone = null!;
[field: SerializeField]int currWaveSize = 0;
void Awake() => safeZone = GetComponentInChildren<SafeZone>();
@ -44,24 +45,30 @@ public class Arena : MonoBehaviour {
var gladiator = Instantiate(entityPrefab, gladiatorParent).GetComponent<Gladiator>();
gladiator.arena = this;
gladiator.transform.position = spawners[spawnerIndex].position;
float randFloat = Random.Range(0.1f, 0.5f);
Vector2 offset = new Vector2(randFloat, randFloat);
gladiator.transform.position = spawners[spawnerIndex].position + offset;
gladiator.direction = spawners[spawnerIndex].direction;
gladiator.gameFlowManager = gameFlowManager;
}
IEnumerator SpawnEnemies() {
yield return new WaitForSeconds(stats.initWaitToSpawn);
currWaveSize = stats.initWaveSize;
int currentSpawner = 0;
int amountSpawned = 0;
int wave = 1;
while(true){
while (amountSpawned < stats.waveSize) {
while (amountSpawned < currWaveSize) {
currentSpawner = Random.Range(0, spawners.Length);
SpawnEnemy(currentSpawner);
amountSpawned++;
amountSpawned++;
}
if(wave++ >= stats.increaseWaveStep){
if((currWaveSize += stats.waveIncrease) > stats.maxWaveSize) currWaveSize=stats.maxWaveSize;
}
yield return new WaitForSeconds(stats.secondsBetweenSpawners);
amountSpawned = 0;
yield return new WaitForSeconds(stats.secondsBetweenSpawners);
}
}

View File

@ -4,6 +4,9 @@
public class ArenaStats : ScriptableObject {
[Min(0f)] public float secondsBetweenSpawners = 3f;
[Min(0f)] public float initWaitToSpawn = 3f;
[Min(0f)] public float waveSize = 3f;
[Min(0f)] public int initWaveSize = 3;
[Min(0f)] public int maxWaveSize = 10;
[Min(0f), Tooltip("The amount of gladiator to add to wave")] public int waveIncrease = 1;
[Min(0f), Tooltip("How many waves before we increase by WaveIncrease")] public int increaseWaveStep = 3;
}

View File

@ -238,7 +238,18 @@
{
"name": "",
"id": "d325e36d-0a45-4f07-968e-7d1f67d80899",
"path": "<Keyboard>/e",
"path": "<Keyboard>/f",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Suck",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "6d6b0cf1-60af-4bf9-bb3d-5ed163e669fc",
"path": "<Mouse>/leftButton",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
@ -312,6 +323,17 @@
"isComposite": false,
"isPartOfComposite": true
},
{
"name": "",
"id": "cc59ae2e-998f-4c7b-a5cc-4a164aedfe2d",
"path": "<Mouse>/scroll/y",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "SwitchMinion",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "4715f838-717a-4f10-a668-05a6d761a7bc",
@ -388,6 +410,17 @@
"action": "Throw",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "70991f2d-c585-4b19-bf50-8c9757aab592",
"path": "<Mouse>/rightButton",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Throw",
"isComposite": false,
"isPartOfComposite": false
}
]
},