示例#1
0
 public void RosValidate()
 {
     if (ActionGoal is null)
     {
         throw new System.NullReferenceException(nameof(ActionGoal));
     }
     ActionGoal.RosValidate();
     if (ActionResult is null)
     {
         throw new System.NullReferenceException(nameof(ActionResult));
     }
     ActionResult.RosValidate();
     if (ActionFeedback is null)
     {
         throw new System.NullReferenceException(nameof(ActionFeedback));
     }
     ActionFeedback.RosValidate();
 }
示例#2
0
 public void RosSerialize(ref Buffer b)
 {
     ActionGoal.RosSerialize(ref b);
     ActionResult.RosSerialize(ref b);
     ActionFeedback.RosSerialize(ref b);
 }
示例#3
0
        public void determineNextGoal()
        {
            TreeNode <CreationTreeNode> action_taker_node = CreationMythState.CreationTree.TreeRoot.searchNode(compareNode, new CreationTreeNode(this));

            if (action_taker_node == null)
            {
                _current_goal = ActionGoal.None;
                _action_fsm.Advance(new Wait());
                CreationMythLogger.UpdateActionLog(this);
                return;
            }

            foreach (TreeNode <CreationTreeNode> child in action_taker_node.Children)
            {
                if (child.Value.MythObject != null)
                {
                    continue;
                }

                switch (child.Value.Character)
                {
                case "p":
                    CreationMythLogger.UpdateActionLog("Start the creation of a plane.");
                    _current_goal = ActionGoal.CreatePlane;
                    child.Value.UnderConstruction = true;
                    child.Value.Creator           = this;
                    return;

                case "d":
                    CreationMythLogger.UpdateActionLog("Start the creation of a deity.");
                    _current_goal = ActionGoal.CreateDeity;
                    child.Value.UnderConstruction = true;
                    child.Value.Creator           = this;
                    return;

                default:
                    _current_goal = ActionGoal.None;
                    break;
                }
            }

            if (_current_goal == ActionGoal.None)
            {
                foreach (TreeNode <CreationTreeNode> child in action_taker_node.Children)
                {
                    if (_current_goal == ActionGoal.None && child.Value.Character == "p")
                    {
                        foreach (TreeNode <CreationTreeNode> child_of_child in child.Children)
                        {
                            if (child_of_child.Value.MythObject == null)
                            {
                                switch (child_of_child.Value.Character)
                                {
                                case "w":
                                    CreationMythLogger.UpdateActionLog("Start the creation of a world.");
                                    _current_goal = ActionGoal.CreateWorld;
                                    child_of_child.Value.UnderConstruction = true;
                                    child.Value.Creator = this;
                                    return;

                                case "a":
                                    CreationMythLogger.UpdateActionLog("Start the creation of a sapient species.");
                                    _current_goal = ActionGoal.CreateSapientSpecies;
                                    child.Value.UnderConstruction = true;
                                    child.Value.Creator           = this;
                                    return;

                                default:
                                    _current_goal = ActionGoal.None;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }