i made it // Add to the Update method
void Update() {
if (isSugarRushing) {
// Make him skip/jitter to look "hyper"
transform.position += new Vector3(0, Mathf.Sin(Time.time * 20) * 0.5f, 0);
}
if (isChasing && Vector3.Distance(transform.position, player.position) < 5f) {
// If he catches you during a BSODA chase, he blocks your vision
ShowAnnoyingDrawingOnScreen(); using UnityEngine;
using UnityEngine.AI;
public class ThatKidAge6 : MonoBehaviour
{
public NavMeshAgent agent;
public Transform player;
public AudioSource audioSource;
// Audio Clips for age-appropriate reactions
public AudioClip sugarRushClip; // "CANDY! WOW!"
public AudioClip madClip; // "You got me wet!"
public AudioClip notRichClip; // "You are NOT rich!"
private float normalSpeed = 12f;
private bool isChasing = false;
private bool hasSugarRush = false;
void Start() {
agent = GetComponent<NavMeshAgent>();
agent.speed = normalSpeed;
Wander(); // Start wandering aimlessly
}
void Update() {
// Age 6 skip/jitter effect: Bounces when hyper
if (hasSugarRush) {
float skipHeight = Mathf.Abs(Mathf.Sin(Time.time * 25f)) * 2f;
transform.position = new Vector3(transform.position.x, skipHeight, transform.position.z);
}
// Logic for chasing the player if hit with BSODA
if (isChasing) {
agent.SetDestination(player.position);
} else if (agent.remainingDistance < 1f) {
Wander(); // Keep moving like a curious 6-year-old
}
}
public void InteractWithItem(string itemHeld) {
switch (itemHeld) {
case "ZestyBar":
TriggerSugarRush();
break;
case "BSODA":
TriggerChase();
break;
case "Quarter":
RejectQuarter();
break;
case "Nothing":
Leave();
break;
}
}
void TriggerSugarRush() {
hasSugarRush = true;
agent.speed = 45f; // Extreme speed
audioSource.PlayOneShot(sugarRushClip);
Invoke("ResetBehavior", 10f); // Rush lasts 10 seconds
}
void TriggerChase() {
isChasing = true;
agent.speed = 22f; // Faster than player, but not "sugar rush" fast
audioSource.PlayOneShot(madClip);
}
void RejectQuarter() {
audioSource.PlayOneShot(notRichClip);
// Toss the quarter logic can be added here
Leave();
}
void Leave() {
isChasing = false;
hasSugarRush = false;
agent.speed = normalSpeed;
Wander();
}
void ResetBehavior() {
hasSugarRush = false;
agent.speed = normalSpeed;
transform.position = new Vector3(transform.position.x, 0, transform.position.z); // Stop bouncing
}
void Wander() {
Vector3 newPos = Random.insideUnitSphere * 40f;
NavMeshHit hit;
NavMesh.SamplePosiusing UnityEngine;
using UnityEngine.AI;
public class ThatKidScript : MonoBehaviour
{
public NavMeshAgent agent;
public Transform player;
public AudioSource audioDevice;
public AudioClip sugarRushSound;
public AudioClip ChaseSound;
public AudioClip richQuote;
private bool isChasing = false;
private float speedOriginal = 15f;
void Start() {
agent = GetComponent<NavMeshAgent>();
agent.speed = speedOriginal;
Wander();
}
// This function is called when the player clicks on the character with an item
public void ClickedWithItem(string itemName)
{
switch (itemName)
{
case "ZestyBar": // Give Zesty Bar
ApplySugarRush();
break;
case "BSODA": // Give BSODA
StartChase();
break;
case "Quarter": // Give Quarter
SayQuote("You are not rich!");
break;
default: // Give nothing or unknown item
LeavePlayer();
break;
}
}
void ApplySugarRush() {
agent.speed = 50f; // Fast speed boost
audioDevice.PlayOneShot(sugarRushSound);
// Set a random far destination to "run away"
Wander();
}
void StartChase() {
isChasing = true;
agent.speed = 25f;
audioDevice.PlayOneShot(ChaseSound);
}
void SayQuote(string text) {
Debug.Log("That Kid says: " + text);
audioDevice.PlayOneShot(richQuote);
}
void LeavePlayer() {
// Character turns around and walks away
Vector3 leaveDir = transform.position - player.position;
agent.SetDestination(transform.position + leaveDir * 10);
}
void Update() {
if (isChasing) {
agent.SetDestination(player.position);
}
}
void Wander() {
// Basic Baldi-style wandering logic
Vector3 randomPos = Random.insideUnitSphere * 50;
NavMesh.SamplePosition(randomPos, out NavMeshHit hit, 50, 1);
agent.SetDestination(hit.position);
}
}
tion(newPos, out hit, 40f, 1);
agent.SetDestination(hit.position);
}
}
}
}
me when i see r#le 34