Arena can spawn diff gladiators w/ x ratio each
This commit is contained in:
parent
f78582aac8
commit
9d51ed4cfd
@ -62349,10 +62349,13 @@ MonoBehaviour:
|
|||||||
- position: {x: 10, y: -10}
|
- position: {x: 10, y: -10}
|
||||||
direction: {x: 0, y: 1}
|
direction: {x: 0, y: 1}
|
||||||
stats: {fileID: 11400000, guid: fe319ad8c9a37b84e8b45268c913d54c, type: 2}
|
stats: {fileID: 11400000, guid: fe319ad8c9a37b84e8b45268c913d54c, type: 2}
|
||||||
entityPrefab: {fileID: 2004725698506461420, guid: f75821098c495cb43a0bff5d9ef0a671, type: 3}
|
lightGladiator: {fileID: 2004725698506461419, guid: f75821098c495cb43a0bff5d9ef0a671, type: 3}
|
||||||
|
regularGladiator: {fileID: 2004725698506461419, guid: f75821098c495cb43a0bff5d9ef0a671, type: 3}
|
||||||
|
heavyGladiator: {fileID: 1373848176550804357, guid: 99423d7c9a753554e87e6bb7e555018b, type: 3}
|
||||||
<gladiatorParent>k__BackingField: {fileID: 793317230}
|
<gladiatorParent>k__BackingField: {fileID: 793317230}
|
||||||
<minionParent>k__BackingField: {fileID: 1787272690}
|
<minionParent>k__BackingField: {fileID: 1787272690}
|
||||||
<graveyard>k__BackingField: {fileID: 1550580935}
|
<graveyard>k__BackingField: {fileID: 1550580935}
|
||||||
|
currWaveSize: 0
|
||||||
--- !u!114 &1359990806
|
--- !u!114 &1359990806
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -113,6 +113,10 @@ PrefabInstance:
|
|||||||
propertyPath: m_Enabled
|
propertyPath: m_Enabled
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 161084746864990857, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 197677485360569561, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
|
- target: {fileID: 197677485360569561, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: Big Knight Variant
|
value: Big Knight Variant
|
||||||
@ -161,10 +165,30 @@ PrefabInstance:
|
|||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 197677485360569566, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
|
||||||
|
propertyPath: attackCooldown
|
||||||
|
value: 5
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 197677485360569566, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
|
||||||
|
propertyPath: <cost>k__BackingField
|
||||||
|
value: 15
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 197677485360569566, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
|
||||||
|
propertyPath: <Health>k__BackingField
|
||||||
|
value: 80
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 197677485360569566, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
|
- target: {fileID: 197677485360569566, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
|
||||||
propertyPath: <renderer>k__BackingField
|
propertyPath: <renderer>k__BackingField
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 1594628713}
|
objectReference: {fileID: 1594628713}
|
||||||
|
- target: {fileID: 197677485360569566, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
|
||||||
|
propertyPath: <attackDmg>k__BackingField
|
||||||
|
value: 40
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 197677485360569566, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
|
||||||
|
propertyPath: <movementSpeed>k__BackingField
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1378753993384522801, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
|
- target: {fileID: 1378753993384522801, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
|
||||||
propertyPath: m_AnchorMax.x
|
propertyPath: m_AnchorMax.x
|
||||||
value: 0
|
value: 0
|
||||||
|
|||||||
@ -14,4 +14,9 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
secondsBetweenSpawners: 15
|
secondsBetweenSpawners: 15
|
||||||
initWaitToSpawn: 3
|
initWaitToSpawn: 3
|
||||||
waveSize: 3
|
initWaveSize: 3
|
||||||
|
maxWaveSize: 10
|
||||||
|
waveIncrease: 1
|
||||||
|
increaseWaveStep: 3
|
||||||
|
lightRatio: 0.25
|
||||||
|
heavyRatio: 0.1
|
||||||
|
|||||||
@ -21,7 +21,11 @@ public class Arena : MonoBehaviour {
|
|||||||
[SerializeField] [Required]
|
[SerializeField] [Required]
|
||||||
ArenaStats stats = null!;
|
ArenaStats stats = null!;
|
||||||
[SerializeField] [Required]
|
[SerializeField] [Required]
|
||||||
GameObject entityPrefab = null!;
|
public AIEntity lightGladiator = null!;
|
||||||
|
[SerializeField] [Required]
|
||||||
|
public AIEntity regularGladiator = null!;
|
||||||
|
[SerializeField] [Required]
|
||||||
|
public AIEntity heavyGladiator = null!;
|
||||||
|
|
||||||
[field: SerializeField] [field: Required]
|
[field: SerializeField] [field: Required]
|
||||||
public Transform gladiatorParent { get; private set; } = null!;
|
public Transform gladiatorParent { get; private set; } = null!;
|
||||||
@ -39,7 +43,7 @@ public class Arena : MonoBehaviour {
|
|||||||
|
|
||||||
void Start() => StartCoroutine(SpawnEnemies());
|
void Start() => StartCoroutine(SpawnEnemies());
|
||||||
|
|
||||||
void SpawnEnemy(int spawnerIndex) {
|
void SpawnEnemy(int spawnerIndex, AIEntity entityPrefab) {
|
||||||
if (!gameFlowManager.CanDoAction)
|
if (!gameFlowManager.CanDoAction)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -56,18 +60,30 @@ public class Arena : MonoBehaviour {
|
|||||||
yield return new WaitForSeconds(stats.initWaitToSpawn);
|
yield return new WaitForSeconds(stats.initWaitToSpawn);
|
||||||
currWaveSize = stats.initWaveSize;
|
currWaveSize = stats.initWaveSize;
|
||||||
int currentSpawner = 0;
|
int currentSpawner = 0;
|
||||||
|
int lightAmountSpawned = 0;
|
||||||
|
int heavyAmountSpawned = 0;
|
||||||
int amountSpawned = 0;
|
int amountSpawned = 0;
|
||||||
int wave = 1;
|
int wave = 1;
|
||||||
while(true){
|
while(true){
|
||||||
while (amountSpawned < currWaveSize) {
|
while (amountSpawned < currWaveSize) {
|
||||||
currentSpawner = Random.Range(0, spawners.Length);
|
currentSpawner = Random.Range(0, spawners.Length);
|
||||||
SpawnEnemy(currentSpawner);
|
if(currWaveSize >= .5*stats.maxWaveSize && lightAmountSpawned <= stats.maxWaveSize * stats.lightRatio){
|
||||||
amountSpawned++;
|
SpawnEnemy(currentSpawner, lightGladiator);
|
||||||
|
lightAmountSpawned++;
|
||||||
|
}else if(currWaveSize >= .8*stats.maxWaveSize && heavyAmountSpawned <= stats.maxWaveSize * stats.heavyRatio){
|
||||||
|
SpawnEnemy(currentSpawner, heavyGladiator);
|
||||||
|
heavyAmountSpawned++;
|
||||||
|
}else{
|
||||||
|
SpawnEnemy(currentSpawner, regularGladiator);
|
||||||
|
}
|
||||||
|
amountSpawned++;
|
||||||
}
|
}
|
||||||
if(wave++ >= stats.increaseWaveStep){
|
if(wave++ >= stats.increaseWaveStep){
|
||||||
if((currWaveSize += stats.waveIncrease) > stats.maxWaveSize) currWaveSize=stats.maxWaveSize;
|
if((currWaveSize += stats.waveIncrease) > stats.maxWaveSize) currWaveSize=stats.maxWaveSize;
|
||||||
}
|
}
|
||||||
amountSpawned = 0;
|
amountSpawned = 0;
|
||||||
|
lightAmountSpawned = 0;
|
||||||
|
heavyAmountSpawned = 0;
|
||||||
yield return new WaitForSeconds(stats.secondsBetweenSpawners);
|
yield return new WaitForSeconds(stats.secondsBetweenSpawners);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,5 +8,6 @@ public class ArenaStats : ScriptableObject {
|
|||||||
[Min(0f)] public int maxWaveSize = 10;
|
[Min(0f)] public int maxWaveSize = 10;
|
||||||
[Min(0f), Tooltip("The amount of gladiator to add to wave")] public int waveIncrease = 1;
|
[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;
|
[Min(0f), Tooltip("How many waves before we increase by WaveIncrease")] public int increaseWaveStep = 3;
|
||||||
|
[Range(0f, 1f), Tooltip("Percentage of gladiator who are light")] public float lightRatio = 0.25f;
|
||||||
|
[Range(0f, 1f), Tooltip("Percentage of gladiator who are heavy")] public float heavyRatio = 0.1f;
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user