private void SetActiveConditionState(ModelConditionState conditionState) { if (_activeConditionState == conditionState) { return; } RemoveAndDispose(ref _activeModelDrawConditionState); _activeConditionState = conditionState; _activeModelDrawConditionState = AddDisposable( CreateModelDrawConditionStateInstance( conditionState)); }
private void SetActiveConditionState(ModelConditionState conditionState) { if (_activeConditionState == conditionState) { return; } _activeModelDrawConditionState?.Deactivate(); if (!_cachedModelDrawConditionStates.TryGetValue(conditionState, out var modelDrawConditionState)) { modelDrawConditionState = AddDisposable(CreateModelDrawConditionStateInstance(conditionState)); _cachedModelDrawConditionStates.Add(conditionState, modelDrawConditionState); } _activeConditionState = conditionState; _activeModelDrawConditionState = modelDrawConditionState; _activeModelDrawConditionState?.Activate(); }
private void SetActiveConditionState(ModelConditionState conditionState, Random random) { if (_activeConditionState == conditionState || ShouldWaitForRunningAnimationsToFinish()) { return; } if (_activeModelDrawConditionState != null) { _activeModelDrawConditionState.Deactivate(); RemoveAndDispose(ref _activeModelDrawConditionState); } var modelDrawConditionState = AddDisposable(CreateModelDrawConditionStateInstance(conditionState, random)); _activeConditionState = conditionState; _activeModelDrawConditionState = modelDrawConditionState; NLog.LogManager.GetCurrentClassLogger().Info($"Set active condition state for {GameObject.Definition.Name}"); }
private void SetActiveConditionState(ModelConditionState conditionState, Random random) { if (_activeConditionState == conditionState || ShouldWaitForRunningAnimationsToFinish(conditionState)) { return; } _activeModelDrawConditionState?.Deactivate(); if (!_cachedModelDrawConditionStates.TryGetValue(conditionState, out var modelDrawConditionState)) { modelDrawConditionState = AddDisposable(CreateModelDrawConditionStateInstance(conditionState, random)); _cachedModelDrawConditionStates.Add(conditionState, modelDrawConditionState); } _activeConditionState = conditionState; _activeModelDrawConditionState = modelDrawConditionState; var speedFactor = conditionState.AnimationSpeedFactorRange.GetValue(random); _activeModelDrawConditionState?.Activate(speedFactor); }