示例#1
0
 /// <summary>
 /// To use this please pass the node you want to use as root node to this method. It is assumed that in the scene hierarchy this node is the root node to all other NEEDSIMNodes. So if you have  a village with houses and objects in each house you should, in the scene view, make the village parent of the houses, and the houses object of the village, and each game object should have a NEEDSIMNode. You can leave the interactions set to none for the village and the houses if they are just used to calculate the abstraction for the Affordance Tree.
 /// The method BuildTreeBasedOnSceneHierarchy() that is called here will not work for intermediate objects in the hierarchy - there is only deeper search if a direct ancestor is a NEEDSIMNode.
 /// </summary>
 /// <param name="node"></param>
 public void BuildAffordanceTreeFromNode(NEEDSIMNode node)
 {
     node.AffordanceTreeNode = new AffordanceTreeNode(null, node.name, node.speciesName, node.gameObject.transform.position);
     root = node.AffordanceTreeNode;
     Simulation.Manager.Instance.Data.Root = root;
     node.BuildTreeBasedOnSceneHierarchy();
 }
示例#2
0
        public PlanDemo(NEEDSIMNode agent)
        {
            ActionLibrary = new Dictionary <string, Action>();

            ActionLibrary.Add("DecideGoal", new DecideGoal(agent));
            ActionLibrary.Add("MoveToSlot", new MoveToSlot(agent));
            ActionLibrary.Add("SatisfyGoal", new SatisfyGoal(agent));
            ActionLibrary.Add("DecideValue", new DecideValue(agent));
            ActionLibrary.Add("SatisfyUrgentNeed", new SatisfyUrgentNeed(agent));
            ActionLibrary.Add("ChaseSlot", new ChaseSlot(agent));
            ActionLibrary.Add("InterruptionFuchsalarm", new InterruptionFuchsalarm(agent));

            selectedPlan = agent.selectedPlan;

            Plan = getNewPlan();
        }
        void OnEnable()
        {
            myTarget        = this.target as NEEDSIMNode;
            transform       = myTarget.transform;
            IsAgent         = serializedObject.FindProperty("isAgent");
            ShowDebug       = serializedObject.FindProperty("drawGizmosInGame");
            ModifyLookAt    = serializedObject.FindProperty("ModifyLookAt");
            SpeciesName     = serializedObject.FindProperty("speciesName");
            ShowDebugInGame = serializedObject.FindProperty("showDebugInGame");
            //ShowDebugInSpector = serializedObject.FindProperty("showDebugInInspector");
            selectedPlan = serializedObject.FindProperty("selectedPlan");
            SpecificSatisfactionLevelsAtStart = serializedObject.FindProperty("SpecificSatisfactionLevelsAtStart");

            serializedObject.Update();
            serializedObject.ApplyModifiedProperties();

            CreateOptionsBasedOnDatabase();

            lastTransformPosition = transform.position;
            lastEulerAngles       = transform.rotation.eulerAngles;
            lastScale             = transform.lossyScale;
        }
示例#4
0
 public SatisfyUrgentNeed(NEEDSIMNode agent)
     : base(agent)
 {
 }
示例#5
0
 public DecideGoal(NEEDSIMNode agent)
     : base(agent)
 {
 }
示例#6
0
 public void AddNEEDSIMNode(NEEDSIMNode node, NEEDSIMNode parent)
 {
     node.AffordanceTreeNode = new AffordanceTreeNode(parent.AffordanceTreeNode, node.name, node.speciesName, node.gameObject.transform.position);
 }
示例#7
0
 public ChaseSlot(NEEDSIMNode agent)
     : base(agent)
 {
     fox = agent.gameObject.GetComponent <NEEDSIMSampleSceneScripts.Fox>();
 }
示例#8
0
 public Action(NEEDSIMNode agent)
 {
     this.agent = agent;
 }
示例#9
0
 public InterruptionFuchsalarm(NEEDSIMNode agent)
     : base(agent)
 {
     scriptReference = GameObject.FindObjectOfType <NEEDSIMSampleSceneScripts.FuchsalarmDemoScript>();
 }
示例#10
0
 public DecideClosestGoal(NEEDSIMNode agent)
     : base(agent)
 {
 }
示例#11
0
 public void AddNEEDSIMNode(NEEDSIMNode node, AffordanceTreeNode parent)
 {
     node.AffordanceTreeNode = new AffordanceTreeNode(parent, node.name, node.speciesName, node.gameObject.transform.position);
     // In case you do not move NEEDSIMNodes to different gameObjects at runtime you can set the game object here. Otherwise the simplest option is to move this line to NEEDSIMNode.Update()
     node.AffordanceTreeNode.gameObject = node.gameObject;
 }
示例#12
0
 public void AddNEEDSIMNode(NEEDSIMNode node, NEEDSIMNode parent)
 {
     AddNEEDSIMNode(node, parent.AffordanceTreeNode);
 }
示例#13
0
 public void AddNEEDSIMNode(NEEDSIMNode node)
 {
     AddNEEDSIMNode(node, root);
 }
示例#14
0
 public MoveToSlot(NEEDSIMNode agent)
     : base(agent)
 {
 }
 public SatisfyGoalWithConversations(NEEDSIMNode agent)
     : base(agent)
 {
 }
示例#16
0
 public DecideClosestValue(NEEDSIMNode agent)
     : base(agent)
 {
 }
示例#17
0
 public DecideValue(NEEDSIMNode agent)
     : base(agent)
 {
 }
示例#18
0
 public SatisfyGoal(NEEDSIMNode agent)
     : base(agent)
 {
 }