Tweak stats

This commit is contained in:
Yann Dupont 01 2022-04-04 13:05:32 -04:00
parent a346efc487
commit db575d3178
4 changed files with 14 additions and 4 deletions

View File

@ -167,7 +167,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 197677485360569566, guid: b25a487d193f24049b6a791adf592b2e, type: 3} - target: {fileID: 197677485360569566, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
propertyPath: attackCooldown propertyPath: attackCooldown
value: 5 value: 2
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 197677485360569566, guid: b25a487d193f24049b6a791adf592b2e, type: 3} - target: {fileID: 197677485360569566, guid: b25a487d193f24049b6a791adf592b2e, type: 3}
propertyPath: <cost>k__BackingField propertyPath: <cost>k__BackingField

View File

@ -171,7 +171,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3} - target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: attackCooldown propertyPath: attackCooldown
value: 5 value: 2
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3} - target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: <cost>k__BackingField propertyPath: <cost>k__BackingField
@ -187,7 +187,7 @@ PrefabInstance:
objectReference: {fileID: 1175205805} objectReference: {fileID: 1175205805}
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3} - target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: <attackDmg>k__BackingField propertyPath: <attackDmg>k__BackingField
value: 40 value: 30
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3} - target: {fileID: 2399377275812995974, guid: 5f633c05dee3f4b4784f5702b2365f02, type: 3}
propertyPath: <movementSpeed>k__BackingField propertyPath: <movementSpeed>k__BackingField

View File

@ -149,11 +149,15 @@ public class AIEntity : Entity {
} }
protected class SeekState : BaseStateAI { protected class SeekState : BaseStateAI {
float currentSeekResetTimer;
public SeekState(AIEntity entity) : base(entity) { public SeekState(AIEntity entity) : base(entity) {
} }
public override void EnterState() { public override void EnterState() {
currentSeekResetTimer = entity.AIStats.targetCheckTime;
if (!entity.animator.GetCurrentAnimatorStateInfo(0).IsName("Attack")) { if (!entity.animator.GetCurrentAnimatorStateInfo(0).IsName("Attack")) {
entity.animator.Play("Running"); entity.animator.Play("Running");
} }
@ -168,13 +172,18 @@ public class AIEntity : Entity {
if (targetEntity.IsAlive()) {//target is alive, keep chasing it if (targetEntity.IsAlive()) {//target is alive, keep chasing it
return null; return null;
} else {//target is dead, go to findTargetState } else {//target is dead, go to findTargetState
return new FindTargetState(entity); ; return new FindTargetState(entity);
} }
} }
return null; return null;
} }
public override BaseState? FixedUpdateState() { public override BaseState? FixedUpdateState() {
currentSeekResetTimer -= Time.deltaTime;
if(currentSeekResetTimer <= 0f) {
return new FindTargetState(entity);
}
entity.direction = Vector3.RotateTowards(entity.direction, (entity.target.position - entity.transform.position), entity.rotSpeed * Time.fixedDeltaTime, 0.0f).normalized; entity.direction = Vector3.RotateTowards(entity.direction, (entity.target.position - entity.transform.position), entity.rotSpeed * Time.fixedDeltaTime, 0.0f).normalized;
if (entity.IsTargetable(entity.target.GetComponent<Entity>())) { if (entity.IsTargetable(entity.target.GetComponent<Entity>())) {
if (!entity.IsInAttackRange()) { if (!entity.IsInAttackRange()) {

View File

@ -5,6 +5,7 @@ public class AIStats : ScriptableObject {
[field: Min(0f)]public float closeEnough = 1f; [field: Min(0f)]public float closeEnough = 1f;
[field: Min(0f)]public float decayTime = 5f; [field: Min(0f)]public float decayTime = 5f;
[field: Min(0f)]public float stuckCheckTime = 3f; [field: Min(0f)]public float stuckCheckTime = 3f;
[field: Min(0f)] public float targetCheckTime = 1f;
public Vector3[] roamPositions = null!; public Vector3[] roamPositions = null!;