This is a long recipe where we'll implement two extensive classes. It is advised to read the following steps carefully:
- Let's start by creating the class that defines our agents and its member variables:
using UnityEngine; using System.Collections; using System.Collections.Generic; public class AgentAwared : MonoBehaviour { protected Interest interest; protected bool isUpdated = false; }
- Define the function for checking whether a given interest is relevant or not:
public bool IsRelevant(Interest i) { int oldValue = (int)interest.priority; int newValue = (int)i.priority; if (newValue <= oldValue) return false; return true; }
- Implement the function for setting a new interest in the agent:
public void Notice(Interest ...