Пример #1
0
        protected override void SaveSettings()
        {
            ObstacleSensor sensor = ObstacleSensor.Right;

            if (this.rbUpperRightSensor.Checked)
            {
                sensor = ObstacleSensor.UpperRight;
            }
            else if (this.rbLeftSensor.Checked)
            {
                sensor = ObstacleSensor.Left;
            }
            else if (this.rbUpperLeftSensor.Checked)
            {
                sensor = ObstacleSensor.UpperLeft;
            }
            ComparativeOp operation = (ComparativeOp)Enum.ToObject(typeof(ComparativeOp), this.cbOperator.SelectedIndex);
            Variable      variable  = null;
            int           value     = 0;

            if (this.cbCompareVariable.SelectedIndex != 0)
            {
                variable = GraphManager.GetVariable(this.cbCompareVariable.SelectedItem.ToString());
            }
            else
            {
                value = (int)this.nudCompareValue.Value;
            }
            this.action.UpdateSettings(sensor, operation, variable, value);
        }
Пример #2
0
        public AssignObstacleAction(string key, XmlElement properties, System.Collections.Generic.SortedList <string, Variable> variables)
        {
            this.key = key;
            if (properties.Name != "properties")
            {
                throw new ActionException("Can't create the action");
            }
            foreach (XmlElement property in properties.ChildNodes)
            {
                switch (property.Name)
                {
                case "version":
                    break;

                case "assignVariable":
                    if (property.InnerText != "none")
                    {
                        this.assignVariable = variables[property.InnerText];
                    }
                    break;

                case "obstacleSensor":
                    this.obstacleSensor = (ObstacleSensor)Enum.Parse(typeof(ObstacleSensor), property.InnerText);
                    break;

                default:
                    throw new ProjectException("Error el crear la acción");
                }
            }
        }
 public void UpdateSettings(ObstacleSensor obstacleSensor, ComparativeOp operation, Variable compareVariable, int compareValue)
 {
     this.obstacleSensor  = obstacleSensor;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
Пример #4
0
    void FindSensors()
    {
        GameObject fsensor = GameObject.Find("FrontSensorR");

        frontSensor    = fsensor.transform;
        obstacleSensor = fsensor.GetComponent <ObstacleSensor>();
        FindWallSensors();
    }
 public CompareObstacleAction(string key, ObstacleSensor obstacleSensor, ComparativeOp operation, Variable compareVariable, int compareValue)
 {
     this.key             = key;
     this.obstacleSensor  = ObstacleSensor;
     this.operation       = operation;
     this.compareVariable = compareVariable;
     this.compareValue    = compareValue;
 }
Пример #6
0
        protected override void SaveSettings()
        {
            Variable       variable = GraphManager.GetVariable(this.cbAssignVariable.SelectedItem.ToString());
            ObstacleSensor sensor   = ObstacleSensor.Right;

            if (this.rbUpperRightSensor.Checked)
            {
                sensor = ObstacleSensor.UpperRight;
            }
            else if (this.rbLeftSensor.Checked)
            {
                sensor = ObstacleSensor.Left;
            }
            else if (this.rbUpperLeftSensor.Checked)
            {
                sensor = ObstacleSensor.UpperLeft;
            }
            this.action.UpdateSettings(variable, sensor);
        }
Пример #7
0
 public void UpdateSettings(Variable assignVariable, ObstacleSensor obstacleSensor)
 {
     this.assignVariable = assignVariable;
     this.obstacleSensor = obstacleSensor;
 }
Пример #8
0
 public AssignObstacleAction(string key, Variable assignVariable, ObstacleSensor obstacleSensor)
 {
     this.key            = key;
     this.assignVariable = assignVariable;
     this.obstacleSensor = obstacleSensor;
 }
Пример #9
0
 void FindSensors()
 {
     GameObject fsensor = GameObject.Find("FrontSensorR");
     frontSensor = fsensor.transform;
     obstacleSensor = fsensor.GetComponent<ObstacleSensor>();
     FindWallSensors();
 }