Along with the action chooser, we will create base classes for actions and goals:
- First, we'll create the base class for modeling actions, as shown in the following code:
using UnityEngine;using System.Collections;public class ActionGOB : MonoBehaviour{ public virtual float GetGoalChange(GoalGOB goal) { return 0f; } public virtual float GetDuration() { return 0f; }}
- Next, we'll create the GoalGOB parent class with member variables, as shown in the following code:
using UnityEngine;using System.Collections;public class GoalGOB{ public string name; public float value; public float change;}
- Next, we'll define the proper functions for handling discontentment and change over time, as demonstrated in the following code: