private void SubmitTaskToClientTaskEngine(TaskTemplateType templateType, params TaskInfo[] defines) { m_playersBot.Init(); int playerIndex = m_gameState.LocalToPlayerIndex(m_localPlayerIndex); IMatchPlayerView playerView = m_gameState.GetPlayerView(playerIndex); long[] selection = m_unitSelection.GetSelection(playerIndex, playerIndex); for (int i = 0; i < selection.Length; ++i) { m_playersBot.SubmitTask(Time.realtimeSinceStartup, playerView.GetUnit(selection[i]), templateType, defines); } }
protected override void OnConstruct() { if (InputsCount > 1) { ReadFirstInput(); } if (InputsCount > 0) { long unitIndex = ReadInput <long>(m_taskInfo.Inputs[0]); m_taskInfo.Cmd.UnitIndex = unitIndex; } if (m_unit != null) { return; } IMatchPlayerView playerView = m_taskEngine.MatchEngine.GetPlayerView(m_taskInfo.PlayerIndex); if (playerView == null) { m_taskInfo.State = TaskState.Completed; m_taskInfo.StatusCode = TaskInfo.TaskFailed; return; } m_unit = playerView.GetUnit(m_taskInfo.Cmd.UnitIndex); if (m_unit == null) { m_taskInfo.State = TaskState.Completed; m_taskInfo.StatusCode = TaskInfo.TaskFailed; return; } else { if (!m_taskEngine.IsClient) { m_unit.CmdExecuted += OnCmdExecuted; } SubmitCommand(); } }