Пример #1
0
 public void setProperty(string name, WorldStateValue stateValue)
 {
     if (!properties.ContainsKey(name))
     {
         properties.Add(name, stateValue);
     }
     else
     {
         properties[name] = stateValue;
     }
 }
Пример #2
0
    public void SetProperty(string name, WorldStateValue stateValue) //add a property to the worldstate
    {
        if (!properties.ContainsKey(name))                           //if not contains the property, add it

        {
            properties.Add(name, stateValue);
        }
        else             //if it contains it change its value

        {
            properties[name] = stateValue;
        }
    }
Пример #3
0
    public WorldState GetGoal(int slump)     //get a new goal from the list of available actions
    {
        string          key    = "";
        WorldStateValue val    = new WorldStateValue(true);
        Action          action = actionsList[slump];

        foreach (KeyValuePair <string, WorldStateValue> pair in action.postConditions.GetProperties())
        {
            key = pair.Key;
            val = pair.Value;
            break;
        }

        return(new WorldState(key, val));
    }
Пример #4
0
    public WorldState GetGoal(int slump)
    {
        string          key    = "";
        WorldStateValue val    = new WorldStateValue(true);
        Action          action = actionsList[slump];//.GetActionName();

        foreach (KeyValuePair <string, WorldStateValue> pair in action.postConditions.getProperties())
        {
            key = pair.Key;
            val = pair.Value;
            break;
        }
        //int slump = 3;

        /*string toBuild;
         *
         * string action = actionsList[slump].GetActionName();
         *
         * for (int i = 1; i < action.Length; i++)
         * {
         *              if (char.IsUpper(action[i]))
         *              {
         *                      toBuild = action.Substring(i, action.Length-6);
         *                      break;
         *              }
         * }
         *
         *
         * if(action.Substring(0, 1) == "B")
         * {
         *      toBuild = action.Substring(5, action.Length-6);
         *      char.ToLower(toBuild[0]);
         *      //toBuild = char.ToLower(toBuild[0]) + toBuild.Substring(1);
         *
         *      Debug.Log ("------------------------------>GetGoal()" + toBuild);
         *      return new WorldState(toBuild + "IsBuilt", new WorldStateValue(true));
         * }*/
        //Debug.Log ("------------------------------>GetGoal() = " + key);
        return(new WorldState(key, val));
    }
Пример #5
0
 public WorldState(string name, WorldStateValue stateValue)
 {
     properties = new Dictionary <string, WorldStateValue>();
     properties.Add(name, stateValue);
 }
Пример #6
0
 public WorldState(string name, WorldStateValue stateValue)     //create a worldstate with one property
 {
     properties = new Dictionary <string, WorldStateValue>();
     properties.Add(name, stateValue);
 }
Пример #7
0
 //create a worldstate with one property
 public WorldState(string name, WorldStateValue stateValue)
 {
     properties = new Dictionary<string, WorldStateValue>();
     properties.Add(name, stateValue);
 }
Пример #8
0
    //add a property to the worldstate
    public void SetProperty(string name, WorldStateValue stateValue)
    {
        if(!properties.ContainsKey(name)){ //if not contains the property, add it

            properties.Add(name, stateValue);

        } else { //if it contains it change its value

            properties[name] = stateValue;
        }
    }
Пример #9
0
    //get a new goal from the list of available actions
    public WorldState GetGoal(int slump)
    {
        string key = "";
        WorldStateValue val = new WorldStateValue(true);
        Action action = actionsList[slump];
        foreach(KeyValuePair<string,WorldStateValue> pair in action.postConditions.GetProperties())
        {
            key = pair.Key;
            val = pair.Value;
            break;
        }

        return new WorldState(key, val);
    }
Пример #10
0
    public WorldState GetGoal(int slump)
    {
        string key = "";
        WorldStateValue val = new WorldStateValue(true);
        Action action = actionsList[slump];//.GetActionName();
        foreach(KeyValuePair<string,WorldStateValue> pair in action.postConditions.getProperties())
        {
            key = pair.Key;
            val = pair.Value;
            break;
        }
        //int slump = 3;
        /*string toBuild;

        string action = actionsList[slump].GetActionName();

        for (int i = 1; i < action.Length; i++)
        {
                if (char.IsUpper(action[i]))
                {
                    toBuild = action.Substring(i, action.Length-6);
                    break;
                }
        }

        if(action.Substring(0, 1) == "B")
        {
            toBuild = action.Substring(5, action.Length-6);
            char.ToLower(toBuild[0]);
            //toBuild = char.ToLower(toBuild[0]) + toBuild.Substring(1);

            Debug.Log ("------------------------------>GetGoal()" + toBuild);
            return new WorldState(toBuild + "IsBuilt", new WorldStateValue(true));
        }*/
        //Debug.Log ("------------------------------>GetGoal() = " + key);
        return new WorldState(key, val);
    }
 public WorldStateProperty(string name, WorldStateValue stateValue)
 {
     propertyName = name;
     propertyValue = stateValue;
 }
Пример #12
0
    public void setProperty(string name, WorldStateValue stateValue)
    {
        if(!properties.ContainsKey(name)){

            properties.Add(name, stateValue);
        } else {
            properties[name] = stateValue;
        }
    }
 public WorldStateProperty(string name, WorldStateValue stateValue)
 {
     propertyName  = name;
     propertyValue = stateValue;
 }