diff options
| author | Sarah Bradley <git@sarahduck.ca> | 2024-01-24 02:34:41 -0800 |
|---|---|---|
| committer | Sarah Bradley <git@sarahduck.ca> | 2024-01-24 02:34:41 -0800 |
| commit | f9291d8330e2d587544fa650d8d070f34ff0475d (patch) | |
| tree | ce4b7a91397c4009c6175d785b5c77a1d8f12a36 /OnekoLocal.cs | |
| parent | 163c983130fe090182b0bb3ab7b7402921705083 (diff) | |
AI Balancing
Sleep recharges energy faster, yawns are longer but less frequent, stuff takes less energy, more likely to go into sleep if bored
Diffstat (limited to 'OnekoLocal.cs')
| -rw-r--r-- | OnekoLocal.cs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/OnekoLocal.cs b/OnekoLocal.cs index 89dacb9..6c3c2df 100644 --- a/OnekoLocal.cs +++ b/OnekoLocal.cs @@ -130,13 +130,13 @@ class OnekoLocal : Oneko public override void Update(float delta) { InactivityTimer += delta; - Energy -= delta/100f; + Energy -= delta/150f; Neko.Animation = Idle; if (InactivityTimer > 1.5f && InactivityTimer < 3f) Neko.Animation = Clean; if (InactivityTimer > 5f && InactivityTimer < 6.5f) Neko.Animation = ScratchSelf; if (InactivityTimer > 10f) { - if (Energy < 0.5f) SleepState.Sleeping = true; + if (Energy < 0.7f) SleepState.Sleeping = true; else RandomSpotState.NewSpotNow = true; } } @@ -167,7 +167,7 @@ class OnekoLocal : Oneko public override void Update(float delta) { SleepTimer += delta; - Energy += delta/90f; + Energy += delta/60f; if (SleepTimer < 1f) Neko.Animation = Yawn; else Neko.Animation = Sleep; @@ -198,7 +198,7 @@ class OnekoLocal : Oneko public override void Update(float delta) { if (ClosestNeko is null) return; - Energy -= delta/50f; + Energy -= delta/60f; Playfullness += delta/60f; Vector2 Direction = Raymath.Vector2Rotate(Directions.Up, DateTime.Now.Second+RandOffset); Neko.MoveTowardsPosition(ClosestNeko.Position + Direction*100); @@ -274,7 +274,7 @@ class OnekoLocal : Oneko MousePosition = MouseToChase.Position; Neko.MoveTowardsPosition(MousePosition); - Energy -= delta/40f; + Energy -= delta/60f; Playfullness -= delta/30f; } @@ -314,7 +314,7 @@ class OnekoLocal : Oneko return; } Neko.MoveTowardsPosition(Spot); - Energy -= delta/40f; + Energy -= delta/60f; if (Vector2.Distance(Spot, Neko.Position) < 10) NextInvestigation = DateTime.Now.AddSeconds(Random.Shared.NextSingle() * 120); @@ -352,15 +352,15 @@ class OnekoLocal : Oneko public override int GetPriority() { - if (Energy < 0.3f && Neko.CurrentAIState is not SleepState && (YawnTimer > 0f || Random.Shared.NextSingle() > 0.96f)) return 2000; + if (Energy < 0.25f && Neko.CurrentAIState is not SleepState && (YawnTimer > 0f || Random.Shared.NextSingle() > 0.98f)) return 2000; else return -1; } - public override void StartState() => YawnTimer = 1.5f; + public override void StartState() => YawnTimer = 2f; public override void Update(float delta) { YawnTimer -= delta; - Energy -= delta/80f; + Energy -= delta/60f; Neko.Animation = Yawn; } } |
