Different values for monsters

This commit is contained in:
Soulaha Balde 2022-04-03 17:56:30 -04:00
parent c718c9e595
commit f78582aac8
8 changed files with 50 additions and 16 deletions

View File

@ -109,6 +109,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 160730869004340736, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 2399377275812995968, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: m_RootOrder
value: 0
@ -153,10 +157,34 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 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}
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: <renderer>k__BackingField
value:
objectReference: {fileID: 1205254930}
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, 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}
propertyPath: m_Name
value: Goblin Variant

View File

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

View File

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

View File

@ -12,6 +12,7 @@ public class AIEntity : Entity {
public bool facingRight { get; private set; } = true;
protected Vector3 moatExtents;
protected bool isAvoiding = false;
[field: SerializeField] public float cost{ get; private set; } = 10f;
override protected void Start() {
base.Start();
@ -281,6 +282,7 @@ public class AIEntity : Entity {
Entity targetEntity = entity.target.GetComponent<Entity>();
if (targetEntity != null) {
targetEntity.TakeDamage(entity.attackDmg, entity);
entity.rb.velocity = Vector3.zero;
bool isTargetAlive = targetEntity.IsAlive();
if (!isTargetAlive) {
return new FindTargetState(entity);

View File

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

View File

@ -15,3 +15,5 @@ MonoBehaviour:
movementSpeed: 4
suckSpeed: 1
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)]
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;
List<Entity> minionTypes;
List<AIEntity> minionTypes;
List<MinionIcon> minionIcons;
int currentIndex;
void Awake() {
minionTypes = new List<Entity>();
minionTypes = new List<AIEntity>();
minionIcons = new List<MinionIcon>();
}
@ -39,7 +39,7 @@ public class MinionBar : MonoBehaviour {
// print("new selected minion type : " + currentIndex.ToString());
}
public void AddMinionType(Entity newMinionPrefab) {
public void AddMinionType(AIEntity newMinionPrefab) {
minionTypes.Add(newMinionPrefab);
MinionIcon newIcon = Instantiate(minionIconPrefab, transform)
.GetComponent<MinionIcon>();
@ -67,7 +67,7 @@ public class MinionBar : MonoBehaviour {
}
}
public Entity GetCurrentMinion() {
public AIEntity GetCurrentMinion() {
return minionTypes[currentIndex];
}