public override void OnStateChanged(VoxelDataState prevState, VoxelDataState newState) { base.OnStateChanged(prevState, newState); if (prevState == VoxelDataState.Mutating) { UpdateProgressUI(false); m_isInProgress = false; } }
protected void OnInstantCmd(VoxelDataState state, int beginCmdCode, Cmd cmd, int delay, int duration) { State = state; if (beginCmdCode != CmdCode.Nop) { Cmd beginCmd = cmd.Clone(); beginCmd.Code = beginCmdCode; beginCmd.Duration = delay; m_commandsQueue.Enqueue(beginCmd); } cmd.Duration = duration; m_commandsQueue.Enqueue(cmd); }
protected virtual void OnStateChanged(Cmd cmd) { ChangeParamsCmd changeParamsCmd = (ChangeParamsCmd)cmd; VoxelDataState prevState = m_dataController.GetVoxelDataState(); CmdResultCode noFail = m_dataController.SetVoxelDataState((VoxelDataState)changeParamsCmd.IntParams[1]); if (noFail != CmdResultCode.Success) { throw new InvalidOperationException(); } if (m_controlledVoxel != null) { m_controlledVoxel.OnStateChanged(prevState, m_dataController.GetVoxelDataState()); } }
protected override void OnEvaluating(ExpressionInfo expression, IMatchPlayerView player, IMatchUnitAssetView unit, ITaskEngine taskEngine, Action <object> callback) { VoxelDataState state = unit.DataController.GetVoxelDataState(); callback(state); }
public virtual void OnStateChanged(VoxelDataState prevState, VoxelDataState newState) { }
public override void OnStateChanged(VoxelDataState prevState, VoxelDataState newState) { base.OnStateChanged(prevState, newState); UpdateUI(false); }
public void Tick(long tick, out Cmd cmd) { if (m_createdVoxels.Count != 0) { m_createdVoxels.Clear(); } if (m_eatenOrDestroyedVoxels.Count != 0) { m_eatenOrDestroyedVoxels.Clear(); } if (!m_dataController.IsAlive) { if (State != VoxelDataState.Idle) { RaiseCmdFailed(null, CmdResultCode.Fail_NoUnit); } else { GoToIdleState(); } cmd = null; return; } if (m_ticksBeforeNextCommand == 0) { cmd = OnTick(tick); if (State != m_prevState) { if (cmd != null) { cmd = new CompositeCmd { UnitIndex = cmd.UnitIndex, Duration = cmd.Duration, Commands = new[] { cmd, new ChangeParamsCmd(CmdCode.StateChanged) { UnitIndex = cmd.UnitIndex, Duration = cmd.Duration, IntParams = new[] { (int)m_prevState, (int)State } } } }; } else { cmd = new ChangeParamsCmd(CmdCode.StateChanged) { UnitIndex = Id, IntParams = new[] { (int)m_prevState, (int)State } }; } CmdResultCode noFail = m_dataController.SetVoxelDataState(State); if (noFail != CmdResultCode.Success) { throw new InvalidOperationException(""); } m_prevState = State; } return; } else { m_ticksBeforeNextCommand--; } cmd = null; return; }