本文整理汇总了C#中VariableState类的典型用法代码示例。如果您正苦于以下问题:C# VariableState类的具体用法?C# VariableState怎么用?C# VariableState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VariableState类属于命名空间,在下文中一共展示了VariableState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetState
void SetState (string identifier, VariableState state)
{
var variable = usedVariables.FirstOrDefault (v => v.Name == identifier);
if (variable == null)
return;
VariableState oldState;
if (states.TryGetValue (variable, out oldState)) {
if (oldState < state)
states [variable] = state;
} else {
states [variable] = state;
}
}
示例2: BreakIntoPieces
private void BreakIntoPieces(VariableState newRockState)
{
for (int i = 0; i < NumberOfRocksToBreakInto; i++)
{
Rock newRock = RockBlaster.Factories.RockFactory.CreateNew();
newRock.Position = this.Position;
newRock.Position.X += -1 + 2 * (float)(FlatRedBallServices.Random.NextDouble());
newRock.Position.Y += -1 + 2 * (float)(FlatRedBallServices.Random.NextDouble());
float randomAngle =
(float)(FlatRedBallServices.Random.NextDouble() * System.Math.PI * 2);
float speed = 0 + (float)(FlatRedBallServices.Random.NextDouble() * RandomSpeedOnBreak);
newRock.Velocity = FlatRedBall.Math.MathFunctions.AngleToVector(randomAngle) * speed;
newRock.CurrentState = newRockState;
}
}
示例3: GetVariableState
private VariableState GetVariableState(Operand operand)
{
VariableState variable;
if (!variableStates.TryGetValue(operand, out variable))
{
variable = new VariableState(operand);
variableStates.Add(operand, variable);
}
return variable;
}
示例4: InterpolateBetween
public void InterpolateBetween(VariableState firstState, VariableState secondState, float interpolationValue)
{
#if DEBUG
if (float.IsNaN(interpolationValue))
{
throw new Exception("interpolationValue cannot be NaN");
}
#endif
bool setOverallAlpha = true;
float OverallAlphaFirstValue= 0;
float OverallAlphaSecondValue= 0;
switch(firstState)
{
case VariableState.Activated:
OverallAlphaFirstValue = 1f;
break;
case VariableState.Deactivated:
OverallAlphaFirstValue = 0f;
break;
}
switch(secondState)
{
case VariableState.Activated:
OverallAlphaSecondValue = 1f;
break;
case VariableState.Deactivated:
OverallAlphaSecondValue = 0f;
break;
}
if (setOverallAlpha)
{
OverallAlpha = OverallAlphaFirstValue * (1 - interpolationValue) + OverallAlphaSecondValue * interpolationValue;
}
if (interpolationValue < 1)
{
mCurrentState = (int)firstState;
}
else
{
mCurrentState = (int)secondState;
}
}
示例5: AddInstruction
private void AddInstruction(VariableState variable)
{
foreach (var use in variable.Operand.Uses)
{
if (executedStatements.Contains(use))
{
AddInstruction(use);
}
}
}
示例6: StopStateInterpolation
public void StopStateInterpolation (VariableState stateToStop)
{
switch(stateToStop)
{
case VariableState.Opaque:
SpriteObject.AlphaRate = 0;
break;
case VariableState.Transparent:
SpriteObject.AlphaRate = 0;
break;
}
CurrentState = stateToStop;
}
示例7: StopStateInterpolation
public void StopStateInterpolation(VariableState stateToStop)
{
switch(stateToStop)
{
case VariableState.Activated:
OverallAlphaVelocity = 0;
break;
case VariableState.Deactivated:
OverallAlphaVelocity = 0;
break;
}
CurrentState = stateToStop;
}
示例8: UpdateToOverDefined
private void UpdateToOverDefined(VariableState variable)
{
if (variable.IsOverDefined)
return;
variable.IsOverDefined = true;
if (MainTrace.Active) MainTrace.Log(variable.ToString());
AddInstruction(variable);
}
示例9: PushState
/// <summary>Sets the current state, and pushes that state onto the back stack.</summary>
public void PushState(VariableState state)
{
this.CurrentState = state;
#if !MONOGAME
ScreenManager.PushStateToStack((int)this.CurrentState);
#endif
}
示例10: StopStateInterpolation
public void StopStateInterpolation(VariableState stateToStop)
{
switch(stateToStop)
{
case VariableState.R_Idle:
break;
case VariableState.L_Idle:
break;
case VariableState.R_Hurt:
break;
case VariableState.L_Hurt:
break;
case VariableState.R_Die:
break;
case VariableState.L_Die:
break;
case VariableState.R_Attack:
break;
case VariableState.L_Attack:
break;
case VariableState.R_Walking:
break;
case VariableState.L_Walking:
break;
}
CurrentState = stateToStop;
}
示例11: StopStateInterpolation
public void StopStateInterpolation (VariableState stateToStop)
{
switch(stateToStop)
{
case VariableState.Hayek:
break;
case VariableState.Keynes:
break;
case VariableState.Malthus:
break;
case VariableState.Smith:
break;
}
CurrentState = stateToStop;
}
示例12: InterpolateBetween
public void InterpolateBetween(VariableState firstState, VariableState secondState, float interpolationValue)
{
#if DEBUG
if (float.IsNaN(interpolationValue))
{
throw new Exception("interpolationValue cannot be NaN");
}
#endif
switch(firstState)
{
case VariableState.R_Idle:
break;
case VariableState.L_Idle:
break;
case VariableState.R_Hurt:
break;
case VariableState.L_Hurt:
break;
case VariableState.R_Die:
break;
case VariableState.L_Die:
break;
case VariableState.R_Attack:
break;
case VariableState.L_Attack:
break;
case VariableState.R_Walking:
break;
case VariableState.L_Walking:
break;
}
switch(secondState)
{
case VariableState.R_Idle:
break;
case VariableState.L_Idle:
break;
case VariableState.R_Hurt:
break;
case VariableState.L_Hurt:
break;
case VariableState.R_Die:
break;
case VariableState.L_Die:
break;
case VariableState.R_Attack:
break;
case VariableState.L_Attack:
break;
case VariableState.R_Walking:
break;
case VariableState.L_Walking:
break;
}
}
示例13: InterpolateToState
public Instruction InterpolateToState(VariableState stateToInterpolateTo, double secondsToTake)
{
switch(stateToInterpolateTo)
{
case VariableState.R_Idle:
break;
case VariableState.L_Idle:
break;
case VariableState.R_Hurt:
break;
case VariableState.L_Hurt:
break;
case VariableState.R_Die:
break;
case VariableState.L_Die:
break;
case VariableState.R_Attack:
break;
case VariableState.L_Attack:
break;
case VariableState.R_Walking:
break;
case VariableState.L_Walking:
break;
}
var instruction = new DelegateInstruction<VariableState>(StopStateInterpolation, stateToInterpolateTo);
instruction.TimeToExecute = TimeManager.CurrentTime + secondsToTake;
this.Instructions.Add(instruction);
return instruction;
}
示例14: StopStateInterpolation
public void StopStateInterpolation(VariableState stateToStop)
{
switch(stateToStop)
{
case VariableState.Regular:
break;
case VariableState.Pressed:
break;
case VariableState.Disabled:
break;
case VariableState.Hover:
break;
}
CurrentState = stateToStop;
}
示例15: InterpolateToState
public Instruction InterpolateToState(VariableState stateToInterpolateTo, double secondsToTake)
{
switch(stateToInterpolateTo)
{
case VariableState.Regular:
break;
case VariableState.Pressed:
break;
case VariableState.Disabled:
break;
case VariableState.Hover:
break;
}
var instruction = new DelegateInstruction<VariableState>(StopStateInterpolation, stateToInterpolateTo);
instruction.TimeToExecute = TimeManager.CurrentTime + secondsToTake;
this.Instructions.Add(instruction);
return instruction;
}