Merge branch 'soulaha' into dev

This commit is contained in:
Soulaha Balde 2022-04-03 18:55:24 -04:00
commit 67de6189a1
13 changed files with 124 additions and 56 deletions

View File

@ -62381,7 +62381,9 @@ 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}

View File

@ -169,6 +169,18 @@ PrefabInstance:
propertyPath: attackSounds.Array.size propertyPath: attackSounds.Array.size
value: 5 value: 5
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:
@ -196,6 +208,12 @@ PrefabInstance:
- target: {fileID: 218553800040352715, guid: b25a487d193f24049b6a791adf592b2e, type: 3} - target: {fileID: 218553800040352715, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 4 value: 4
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} 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

View File

@ -160,6 +160,16 @@ PrefabInstance:
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3} - target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: deathSounds.Array.size propertyPath: deathSounds.Array.size
value: 3 value: 3
propertyPath: attackCooldown
value: 0.7
objectReference: {fileID: 0}
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: <cost>k__BackingField
value: 5
objectReference: {fileID: 0}
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: <Health>k__BackingField
value: 30
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3} - target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: <renderer>k__BackingField propertyPath: <renderer>k__BackingField
@ -177,6 +187,17 @@ PrefabInstance:
propertyPath: deathSounds.Array.data[2] propertyPath: deathSounds.Array.data[2]
value: value:
objectReference: {fileID: 8300000, guid: 2bfd74251b8800843abb9121b2e543f2, type: 3} objectReference: {fileID: 8300000, guid: 2bfd74251b8800843abb9121b2e543f2, type: 3}
propertyPath: <attackDmg>k__BackingField
value: 5
objectReference: {fileID: 0}
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: <attackRange>k__BackingField
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: <movementSpeed>k__BackingField
value: 4
objectReference: {fileID: 0}
- target: {fileID: 2399377275812995980, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3} - target: {fileID: 2399377275812995980, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Goblin Variant value: Goblin Variant

View File

@ -853,9 +853,9 @@ MonoBehaviour:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 0} - m_Target: {fileID: 0}
m_TargetAssemblyTypeName: MainMenuManager, Assembly-CSharp m_TargetAssemblyTypeName: GameFlowManager, Assembly-CSharp
m_MethodName: GoToScene m_MethodName: ToStartFlowState
m_Mode: 3 m_Mode: 1
m_Arguments: m_Arguments:
m_ObjectArgument: {fileID: 0} m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine

View File

@ -120,8 +120,8 @@ MonoBehaviour:
gameFlowManager: {fileID: 0} gameFlowManager: {fileID: 0}
playerStats: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2} playerStats: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2}
minionPrefabs: minionPrefabs:
- {fileID: 2674681564269481473, guid: 6385a50f8549b2141a1daf3577c54d0a, type: 3}
- {fileID: 4435383994544937624, guid: d6075d2fe32cab14082dfc6d5f5ebc59, type: 3} - {fileID: 4435383994544937624, guid: d6075d2fe32cab14082dfc6d5f5ebc59, type: 3}
- {fileID: 2674681564269481473, guid: 6385a50f8549b2141a1daf3577c54d0a, type: 3}
aimArrow: {fileID: 5124059627794595469} aimArrow: {fileID: 5124059627794595469}
--- !u!114 &7967951869135974023 --- !u!114 &7967951869135974023
MonoBehaviour: MonoBehaviour:

View File

@ -17,6 +17,7 @@ public class AIEntity : Entity {
public bool facingRight { get; private set; } = true; public bool facingRight { get; private set; } = true;
protected Vector3 moatExtents; protected Vector3 moatExtents;
protected bool isAvoiding = false; protected bool isAvoiding = false;
[field: SerializeField] public float cost{ get; private set; } = 10f;
override protected void Start() { override protected void Start() {
base.Start(); base.Start();
@ -287,6 +288,7 @@ public class AIEntity : Entity {
entity.animator.Play("Attack"); entity.animator.Play("Attack");
entity.soundManager.PlaySound(entity.attackSource, entity.attackSounds, randomPitch: true, createTempSourceIfBusy: true); entity.soundManager.PlaySound(entity.attackSource, entity.attackSounds, randomPitch: true, createTempSourceIfBusy: true);
targetEntity.TakeDamage(entity.attackDmg, entity); targetEntity.TakeDamage(entity.attackDmg, entity);
entity.rb.velocity = Vector3.zero;
bool isTargetAlive = targetEntity.IsAlive(); bool isTargetAlive = targetEntity.IsAlive();
if (!isTargetAlive) { if (!isTargetAlive) {
return new FindTargetState(entity); return new FindTargetState(entity);

View File

@ -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

View File

@ -22,13 +22,17 @@ public class Arena : MonoBehaviour {
[SerializeField] [SerializeField]
[Required] [Required]
ArenaStats stats = null!; ArenaStats stats = null!;
[SerializeField]
[Required]
GameObject entityPrefab = null!;
[field: SerializeField] [field: SerializeField]
[field: Required] [field: Required]
public Transform gladiatorParent { get; private set; } = null!; public Transform gladiatorParent { get; private set; } = null!;
//TODO Add some kind of "MinLength(1)" attribute;
[SerializeField] [Required]
public AIEntity lightGladiator = null!;
[SerializeField] [Required]
public AIEntity regularGladiator = null!;
[SerializeField] [Required]
public AIEntity heavyGladiator = null!;
[field: SerializeField] [field: SerializeField]
[field: Required] [field: Required]
@ -55,7 +59,7 @@ public class Arena : MonoBehaviour {
void OnDestroy() => gameFlowManager.stateChanged -= OnGameFlowStateChanged; void OnDestroy() => gameFlowManager.stateChanged -= OnGameFlowStateChanged;
void SpawnEnemy(int spawnerIndex) { void SpawnEnemy(int spawnerIndex, AIEntity entityPrefab) {
if (!gameFlowManager.CanDoAction) if (!gameFlowManager.CanDoAction)
return; return;
@ -72,20 +76,31 @@ 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){
soundManager.PlaySound(waveSource, waveSounds, randomPitch: true, createTempSourceIfBusy: true); soundManager.PlaySound(waveSource, waveSounds, randomPitch: true, createTempSourceIfBusy: 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){
SpawnEnemy(currentSpawner, lightGladiator);
lightAmountSpawned++;
}else if(currWaveSize >= .8*stats.maxWaveSize && heavyAmountSpawned <= stats.maxWaveSize * stats.heavyRatio){
SpawnEnemy(currentSpawner, heavyGladiator);
heavyAmountSpawned++;
}else{
SpawnEnemy(currentSpawner, regularGladiator);
}
amountSpawned++; 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);
} }

View File

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

View File

@ -11,7 +11,7 @@ public class MinionThrower : MonoBehaviour {
[SerializeField] [Required] [SerializeField] [Required]
PlayerStats playerStats = null!; PlayerStats playerStats = null!;
public Entity[] minionPrefabs = null!; public AIEntity[] minionPrefabs = null!;
public GameObject aimArrow = null!; public GameObject aimArrow = null!;
bool isInThrowMode; bool isInThrowMode;
@ -21,7 +21,6 @@ public class MinionThrower : MonoBehaviour {
PlayerMovement movement = null!; PlayerMovement movement = null!;
float currentCooldownTimer; float currentCooldownTimer;
float currentInitialCooldown;
void Awake() { void Awake() {
vampireEntity = GetComponent<VampireEntity>(); vampireEntity = GetComponent<VampireEntity>();
@ -31,7 +30,7 @@ public class MinionThrower : MonoBehaviour {
} }
void Start() { void Start() {
foreach (Entity minion in minionPrefabs) { foreach (AIEntity minion in minionPrefabs) {
minionBar.AddMinionType(minion); minionBar.AddMinionType(minion);
} }
minionBar.UpdateReload(0f); minionBar.UpdateReload(0f);
@ -40,7 +39,7 @@ public class MinionThrower : MonoBehaviour {
void FixedUpdate() { void FixedUpdate() {
if (currentCooldownTimer > 0f) { if (currentCooldownTimer > 0f) {
currentCooldownTimer -= Time.fixedDeltaTime; currentCooldownTimer -= Time.fixedDeltaTime;
minionBar.UpdateReload(currentCooldownTimer / currentInitialCooldown); minionBar.UpdateReload(currentCooldownTimer / playerStats.currentInitialCooldown);
} }
} }
@ -78,15 +77,15 @@ public class MinionThrower : MonoBehaviour {
return; return;
} }
float minionHealthCost = 10f; // TODO float minionHealthCost = minionBar.GetCurrentMinion().cost;
if (minionHealthCost >= vampireEntity.Health) { if (minionHealthCost >= vampireEntity.Health) {
return; return;
} }
vampireEntity.TakeDamage(minionHealthCost, vampireEntity); vampireEntity.TakeDamage(minionHealthCost, vampireEntity);
currentInitialCooldown = 2f; // TODO
currentCooldownTimer = currentInitialCooldown; currentCooldownTimer = playerStats.currentInitialCooldown;
minionBar.UpdateReload(currentCooldownTimer / currentInitialCooldown); minionBar.UpdateReload(currentCooldownTimer / playerStats.currentInitialCooldown);
var newMinion = Instantiate(minionBar.GetCurrentMinion().gameObject, arena.minionParent) var newMinion = Instantiate(minionBar.GetCurrentMinion().gameObject, arena.minionParent)
.GetComponent<Monster>(); .GetComponent<Monster>();

View File

@ -15,3 +15,5 @@ MonoBehaviour:
movementSpeed: 4 movementSpeed: 4
suckSpeed: 1 suckSpeed: 1
bloodLossRate: 2 bloodLossRate: 2
<MinJoystickValueForThrowing>k__BackingField: 0.4
currentInitialCooldown: 0.5

View File

@ -13,4 +13,7 @@ public class PlayerStats : ScriptableObject {
[field: SerializeField] [field: Range(0f, 1f)] [field: SerializeField] [field: Range(0f, 1f)]
public float MinJoystickValueForThrowing { get; private set; } = .4f; public float MinJoystickValueForThrowing { get; private set; } = .4f;
[field: SerializeField] [field: Min(0f)]
public float currentInitialCooldown = 0.5f;
} }

View File

@ -7,12 +7,12 @@ public class MinionBar : MonoBehaviour {
public GameObject minionIconPrefab; public GameObject minionIconPrefab;
List<Entity> minionTypes; List<AIEntity> minionTypes;
List<MinionIcon> minionIcons; List<MinionIcon> minionIcons;
int currentIndex; int currentIndex;
void Awake() { void Awake() {
minionTypes = new List<Entity>(); minionTypes = new List<AIEntity>();
minionIcons = new List<MinionIcon>(); minionIcons = new List<MinionIcon>();
} }
@ -39,7 +39,7 @@ public class MinionBar : MonoBehaviour {
// print("new selected minion type : " + currentIndex.ToString()); // print("new selected minion type : " + currentIndex.ToString());
} }
public void AddMinionType(Entity newMinionPrefab) { public void AddMinionType(AIEntity newMinionPrefab) {
minionTypes.Add(newMinionPrefab); minionTypes.Add(newMinionPrefab);
MinionIcon newIcon = Instantiate(minionIconPrefab, transform) MinionIcon newIcon = Instantiate(minionIconPrefab, transform)
.GetComponent<MinionIcon>(); .GetComponent<MinionIcon>();
@ -67,7 +67,7 @@ public class MinionBar : MonoBehaviour {
} }
} }
public Entity GetCurrentMinion() { public AIEntity GetCurrentMinion() {
return minionTypes[currentIndex]; return minionTypes[currentIndex];
} }