Esempio n. 1
0
    private void Awake()
    {
        // Get hold of the agents NavMeshAgent
        agent = this.gameObject.GetComponent <NavMeshAgent>();

        // Check if there are any preConditions in the Inspector
        // and add to the dictionary
        if (preConditions != null)
        {
            foreach (WorldState w in preConditions)
            {
                // Add each item to our Dictionary
                preconditions.Add(w.key, w.value);
            }
        }

        // Check if there are any afterEffects in the Inspector
        // and add to the dictionary
        if (afterEffects != null)
        {
            foreach (WorldState w in afterEffects)
            {
                // Add each item to our Dictionary
                effects.Add(w.key, w.value);
            }
        }
        // Populate our inventory
        inventory = this.GetComponent <GAgent>().inventory;
        // Get our agents beliefs
        beliefs = this.GetComponent <GAgent>().beliefs;
    }
Esempio n. 2
0
    private void Awake()
    {
        // Get hold of the agents NavMeshAgent
        agent = this.gameObject.GetComponent <NavMeshAgent>();

        // Check validity of preConditions
        if (preConditions != null)
        {
            foreach (WorldState w in preConditions)
            {
                // Add each item to our Dictionary
                preconditions.Add(w.key, w.value);
            }
        }

        // Check validity of afterEffects
        if (afterEffects != null)
        {
            foreach (WorldState w in afterEffects)
            {
                // Add each item to our Dictionary
                effects.Add(w.key, w.value);
            }
        }

        inventory    = this.GetComponent <GAgent>().inventory;
        agentBeliefs = this.GetComponent <GAgent>().beliefs;
    }
Esempio n. 3
0
 public void Awake()
 {
     agent = this.gameObject.GetComponent <NavMeshAgent>();
     if (worldPreConditions != null)
     {
         foreach (WorldState w in worldPreConditions)
         {
             preConditions.Add(w.key, w.value);
         }
     }
     if (worldAfterEffects != null)
     {
         foreach (WorldState w in worldAfterEffects)
         {
             effects.Add(w.key, w.value);
         }
     }
     inventory = this.GetComponent <GAgent>().inventory;
     beliefs   = this.GetComponent <GAgent>().beliefs;
 }
Esempio n. 4
0
    public void Awake()
    {                                                              //Initialize
        Agent     = this.gameObject.GetComponent <NavMeshAgent>(); //Find Alternative for Scriptable Object Class
        Inventory = this.GetComponent <GAgent>().Inventory;
        Beliefs   = this.GetComponent <GAgent>().Beliefs;

        if (PreConditions != null)
        {
            foreach (WorldState w in PreConditions)
            {
                Preconditions.Add(w.Key, w.Value);
            }
        }

        if (AfterEffects != null)
        {
            foreach (WorldState w in AfterEffects)
            {
                Effects.Add(w.Key, w.Value);
            }
        }
    }
Esempio n. 5
0
    public void Awake()
    {
        agent        = gameObject.GetComponent <NavMeshAgent>();
        agentBeliefs = GetComponent <GAgent>().beliefs;
        actionName   = this.GetType().Name;
        inventory    = GetComponent <GAgent>().Inventory;
        if (preConditions != null)
        {
            foreach (WorldState condition in preConditions)
            {
                preconditions.Add(condition.key, condition.value);
            }
        }

        if (postConditions != null)
        {
            foreach (WorldState condition in postConditions)
            {
                effects.Add(condition.key, condition.value);
            }
        }
    }
Esempio n. 6
0
    //Runs when an instance of Action is created
    public void Awake()
    {
        agent = this.gameObject.GetComponent <NavMeshAgent>(); //Connects "agent" with the actual navmeshAgent component

        if (preConditions != null)                             //If there ARE preconditions (set in the Unity interface)
        {
            foreach (WorldState w in preConditions)            //Iterate through the preConditions and
            {
                preconditions.Add(w.Key, w.value);             //Add the WORLD STATE preconditions to the preconditions of this action
            }
        }

        if (afterEffects != null)                   //Do the same for the after effects
        {
            foreach (WorldState w in afterEffects)
            {
                effects.Add(w.Key, w.value);
            }
        }

        inventory = this.GetComponent <GAgent>().inventory; //Establish the inventory of the attached agent
        beliefs   = this.GetComponent <GAgent>().beliefs;   //And their beliefs
    }
Esempio n. 7
0
 public void CreateNotNullInventor()
 {
     inventory = new GInventory();
     Assert.IsNotNull(inventory);
 }
Esempio n. 8
0
 public void SetupTests()
 {
     inventory = new GInventory();
 }