Esempio n. 1
0
        internal static double[] convertToArray(ActionInterface action)
        {
            double[] array = new double[NUMBER_OF_ACTIONS];

            if (action is MoveUp)
            {
                array[0] = 1;
            }
            if (action is MoveDown)
            {
                array[1] = 1;
            }
            if (action is MoveLeft)
            {
                array[2] = 1;
            }
            if (action is MoveRight)
            {
                array[3] = 1;
            }
            if (action is Reproduce)
            {
                array[4] = 1;
            }
            if (action is Eat)
            {
                array[5] = 1;
            }
            return array;
        }
Esempio n. 2
0
 public void Act(ActionInterface action)
 {
     if (actionCurrent == action)
     {
         return;
     }
     if (actionCurrent != null)
     {
         actionCurrent.Cancel();
     }
     actionCurrent = action;
 }
 public LookupItemAction(ActionInterface actionPerformer)
 {
     this.actionPerformer = actionPerformer;
 }
 public AddItemAction(ActionInterface actionPerformer)
 {
     this.actionPerformer = actionPerformer;
 }
Esempio n. 5
0
 // add a single action
 public int addAction(ActionInterface p_action)
 {
     int nodeId = -1;
     // store action in list
     int actionId = m_actions.add(p_action);
     //
     if (m_currentNodeId >= 0)
     {
         ActionNode currentNodeRef = m_nodes[m_currentNodeId];
         // and add its id to tree list
         nodeId = m_nodes.add(new ActionNode(actionId, m_currentNodeId, currentNodeRef.m_level + 1));
         // then add new node index as child to parent
         currentNodeRef.m_children.Add(nodeId);
         // set starting position(render) for node
         m_nodes[nodeId].m_renderPos = currentNodeRef.m_renderPos;
     }
     else // first node
     {
         nodeId = m_nodes.add(new ActionNode(actionId, m_currentNodeId, 0));
     }
     m_currentNodeId = nodeId;
     newNodeDirty = true;
     return nodeId;
 }
 public VoidTransactionAction(ActionInterface actionPerformer)
 {
     this.actionPerformer = actionPerformer;
 }
Esempio n. 7
0
 public void EnqueueAction(ActionInterface p_action)
 {
     p_action.PerformAction();
     queuedActions.Add(p_action);
 }
 public GetVoidTransactionReasonsAction(ActionInterface actionPerformer)
 {
     this.actionPerformer = actionPerformer;
 }
Esempio n. 9
0
 public EditorAction(ActionInterface p_action, int p_ID)
 {
     action = p_action;
     groupID = p_ID;
 }
Esempio n. 10
0
 public EditorAction(ActionInterface p_action)
 {
     action = p_action;
     groupID = -1;
 }
 public SuspendTransactionAction(ActionInterface mailSender)
 {
     this.actionPerformer = mailSender;
 }
Esempio n. 12
0
 public LoginAction(ActionInterface actionPerformer)
 {
     this.actionPerformer = actionPerformer;
 }
Esempio n. 13
0
        public void ReceiveAction(ActionInterface p_action)
        {
            if (p_action.GetType() == typeof(ModifyTile))
            {
                ModifyTile action = (ModifyTile)p_action;

                int oldState = -1;

                switch (action.affectedTilemap)
                {
                    case Tilemap.TilemapType.RoadTilemap:
                        oldState = roadTilemap.getState(action.col, action.row);
                        roadTilemap.setState(action.col, action.row, action.state);
                        break;

                    case Tilemap.TilemapType.SingleTilemap:
                        oldState = singlesTilemap.getState(action.col, action.row);
                        singlesTilemap.setState(action.col, action.row, action.state);
                        break;

                    default:
                        break;
                }

                action.state = oldState;
            }
        }