コード例 #1
0
        private void SubmitToEngine(int playerIndex, List <Cmd> commandsToSubmit)
        {
            if (commandsToSubmit.Count == 1)
            {
                ITaskEngine taskEngine = m_engine.GetClientTaskEngine(playerIndex);
                taskEngine.TerminateAll();

                m_engine.Submit(playerIndex, commandsToSubmit[0]);

                //Render hit;
            }
            else if (commandsToSubmit.Count > 1)
            {
                CompositeCmd cmd = new CompositeCmd
                {
                    Commands = commandsToSubmit.ToArray()
                };

                ITaskEngine taskEngine = m_engine.GetClientTaskEngine(playerIndex);
                taskEngine.TerminateAll();

                m_engine.Submit(playerIndex, cmd);
            }
            else
            {
                Debug.LogWarning("No commands to submit");
            }
        }
コード例 #2
0
        public void Reset()
        {
            m_taskEngine.TaskStateChanged -= OnTaskStateChanged;
            m_playerView.UnitCreated      -= OnUnitCreated;
            m_playerView.UnitRemoved      -= OnUnitRemoved;
            m_playerView.AssetCreated     -= OnAssetCreated;
            m_playerView.AssetRemoved     -= OnAssetRemoved;

            foreach (RunningTaskInfo task in m_state.TaskIdToTask.Values)
            {
                TaskInfo taskInfo = m_taskEngine.TerminateTask(task.TaskId);
                m_state.TaskTemplates[task.Type].Release(taskInfo);
            }

            m_taskEngine.TerminateAll();
            m_state.TaskIdToTask.Clear();
            m_state.UnitIdToTask.Clear();
            m_state.BusyUnits.Clear();
            m_state.FreeUnits.Clear();
        }