private void OnScared() { if (Scared != null) { Scared.Invoke(); } }
private void UpdateAI() { if (!CanUpdateAI()) { return; } // If the enemy is dancin' or has brain freeze or scared, that's their AI update // TODO PRERELEASE - make this more efficient; this is just silly ForceDance fd = GetComponent <ForceDance>(); if (fd != null) { fd.UpdateAI(this); return; } BrainFreeze bf = GetComponent <BrainFreeze>(); if (bf != null) { bf.UpdateAI(this); return; } Scared scared = GetComponent <Scared>(); if (scared != null) { scared.TryMoveAwayFromPlayer(this); return; } mEnemyAI.UpdateAI(); }
public override string ToString() { string result = Timestamp.ToString(); result += ";" + Neutral.ToString(); result += ";" + Happy.ToString(); result += ";" + Sad.ToString(); result += ";" + Angry.ToString(); result += ";" + Surprised.ToString(); result += ";" + Scared.ToString(); result += ";" + Disgusted.ToString(); result += ";" + Contempt.ToString(); result += ";" + Valence.ToString(); result += ";" + Arousal.ToString(); return(result); }
private void Awake() { //For scared condition orangeDino = GameObject.FindObjectOfType <OrangeDinoBoo>(); //For angry condition greenDino = GameObject.FindObjectOfType <CubeDinoCollect>(); //For sad condition calCounter = GameObject.FindObjectOfType <CubeCaloryCounter>(); //friend bot not written yet _stateMachine = new StateMachine(); //here the Emotion States are declared and instantiated: var scared = new Scared(this /*, animator*/); var happy = new Happy(this); var sad = new Sad(this); var angry = new Angry(this); //var depressed = new Depressed(this); //here ALL the transitions are added(declared) to _transition At(happy, sad, calCounter.calories > hungerCal); At(sad, happy, calCounter.calories < hungerCal); At(angry, happy, orangeDino.booNear1); At(happy, angry, angry.timeStuck > 1f); _stateMachine.AddAnyTransition(scared, orangeDino.booNear1); At(happy, scared, scared.timeStuck > 3f); //Set the starting ( happy) state _stateMachine.SetState(happy); void At(IState to, IState from, bool condition) => _stateMachine.AddTransition(to, from, condition); }
/// <summary> /// This generates the conditions of the new cow /// </summary> private void GenerateConditions() { //:TODO: add individual variation into fuzzy distributions // Wellness - Physical conditions m_Pain = new Pain(this); m_Sick = new Sick(this); m_Wounded = new Wounded(this); m_Damage = new Damage(this); m_Tired = new Tired(this); m_Hungry = new Hungry(this); m_Thirsty = new Thirsty(this); m_Dead = new Dead(this); // Contentment - Mental conditions m_Anger = new Angry(this); m_Sleepy = new Sleepy(this); m_Scared = new Scared(this); m_Bored = new Bored(this); m_Lonely = new Lonely(this); m_Happy = new Happy(this); m_Eager = new Eager(this); }