diff options
| author | Sarah B <git@sarahduck.ca> | 2023-12-24 22:58:59 -0800 |
|---|---|---|
| committer | Sarah B <git@sarahduck.ca> | 2023-12-24 22:58:59 -0800 |
| commit | 760fb20f4d248d19524392d2b8c3a3fcdb762453 (patch) | |
| tree | afa33078b167e619547b000d0cc225504a6cc4e6 | |
| parent | 0bd51a156b56f661c794782e77c67d616d39f333 (diff) | |
AI Tweaks
| -rw-r--r-- | Oneko.cs | 2 | ||||
| -rw-r--r-- | OnekoLocal.cs | 20 |
2 files changed, 15 insertions, 7 deletions
@@ -120,7 +120,7 @@ abstract class Oneko : Drawable static protected readonly OnekoAnimation Idle = new(Idle1, Idle1, 1); static protected readonly OnekoAnimation Alert = new(Alert1, Alert1, 1); static protected readonly OnekoAnimation Yawn = new(Yawn1, Yawn1, 1); - static protected readonly OnekoAnimation Clean = new(Clean1, Clean1, 1); + static protected readonly OnekoAnimation Clean = new(Idle1, Clean1, 1); static protected readonly OnekoAnimation ScratchSelf = new(Scratch1, Scratch2, 1); static protected readonly OnekoAnimation Sleep = new(Sleep1, Sleep2, 10); static protected readonly OnekoAnimation RunUp = new(RunUp1, RunUp2, 1); diff --git a/OnekoLocal.cs b/OnekoLocal.cs index d8c40f3..bbe3c3b 100644 --- a/OnekoLocal.cs +++ b/OnekoLocal.cs @@ -98,9 +98,10 @@ class OnekoLocal : Oneko InactivityTimer += delta; Neko.Animation = Idle; - if (InactivityTimer > 3f) Neko.Animation = ScratchSelf; - if (InactivityTimer > 5f) Neko.Animation = Yawn; - if (InactivityTimer > 6f) Neko.Animation = Sleep; + if (InactivityTimer > 1.5f && InactivityTimer < 3f) Neko.Animation = Clean; + if (InactivityTimer > 5f) Neko.Animation = ScratchSelf; + if (InactivityTimer > 7f) Neko.Animation = Yawn; + if (InactivityTimer > 8f) Neko.Animation = Sleep; } public override void ExitState() => InactivityTimer = 0f; @@ -114,7 +115,10 @@ class OnekoLocal : Oneko public ChaseMouseState(OnekoLocal neko) : base(neko) { Mouse.Clicked += mouse => { - if (Random.Shared.NextSingle() > 0.4f) MouseToChase = mouse; + if (MouseToChase != mouse && Random.Shared.NextSingle() > 0.3f) { + AlertTimer = 0.5f; + MouseToChase = mouse; + } }; } @@ -146,6 +150,7 @@ class OnekoLocal : Oneko class ItchyState(OnekoLocal neko) : OnekoAIState(neko) { float ItchTimer = -1f; + bool Cleaning = false; public override int GetPriority() { @@ -153,11 +158,14 @@ class OnekoLocal : Oneko else return -1; } - public override void StartState() => ItchTimer = 0.6f + Random.Shared.NextSingle()*3f; + public override void StartState() { + ItchTimer = 1f + Random.Shared.NextSingle()*4f; + Cleaning = Random.Shared.NextSingle() > 0.5f; + } public override void Update(float delta) { ItchTimer -= delta; - Neko.Animation = ScratchSelf; + Neko.Animation = Cleaning ? Clean : ScratchSelf; } } }
\ No newline at end of file |
