protected override void ReadInput() { //End the Action Command after the command time if (ElapsedCommandTime >= CommandTime) { //Check to see how well the player did and send the appropriate result if (CurBarValue >= SuccessRange.StartBarVal) { SendCommandRank(CommandRank.Nice); OnComplete(CommandResults.Success); } else { OnComplete(CommandResults.Failure); } return; } //Make the bar go down by a certain amount FillBar(-DecelerationRate, true); //Check if you pressed the correct button if (IsBarFull == false) { if (AutoComplete == true || Input.GetKeyDown(CurButton) == true) { //If so, fill up the bar by the correct amount FillBar(AmountPerPress, true); //If the bar is full, the bar flashes color and deceleration no longer applies if (IsBarFull == true) { DecelerationRate = 0d; } } } else { //Interpolate the color of the bar //Interpolate the color of the bar float colorVal = UtilityGlobals.PingPong(ElapsedCommandTime / 300f, .3f, 1f); BarFillColor = new Color(colorVal, colorVal, colorVal, 1f); } ElapsedCommandTime += Time.ElapsedMilliseconds; //Check for switching buttons if (Time.ActiveMilliseconds >= PrevButtonSwitchTime) { //Wrap the button index CurButtonIndex = UtilityGlobals.Wrap(CurButtonIndex + 1, 0, ButtonsToPress.Length - 1); PrevButtonSwitchTime = Time.ActiveMilliseconds + ButtonSwitchTime; } }
public override void Update() { ElapsedTime += Time.ElapsedMilliseconds; //Interpolate the color of the bar if it's full if (ActionCmd.IsBarFull == true) { float colorVal = UtilityGlobals.PingPong(ElapsedTime / 300f, .3f, 1f); BarFillColor = new Color(colorVal, colorVal, colorVal, 1f); } }
public void Update() { /* The ProgressTextStar does the following: * 1. Rotates back and forth about 25 degrees from 0 * 2. Scales down and up very slightly when rotating away from and towards 0, respectively */ ElapsedTime += Time.ElapsedMilliseconds; //Scale twice as fast, as it should be at max scale with a rotation of 0 and min scale when fully rotated in either direction Scale = Interpolation.Interpolate(MinScale, MaxScale, UtilityGlobals.PingPong((ElapsedTime * 2) / RotateTime, 1), Interpolation.InterpolationTypes.Linear); Rotation = UtilityGlobals.ToRadians(Interpolation.Interpolate(MinRotation, MaxRotation, UtilityGlobals.PingPong(ElapsedTime / RotateTime, 1), Interpolation.InterpolationTypes.Linear)); }
public void Update() { /* The ProgressTextStar does the following: * 1. Rotates back and forth about 30 degrees from 0 * 2. Scales down and up very slightly when rotating away from and towards 0, respectively */ ElapsedTime += Time.ElapsedMilliseconds; Scale = Interpolation.Interpolate(MinScale, MaxScale, UtilityGlobals.PingPong(ElapsedTime * 2, RotateTime) / RotateTime, Interpolation.InterpolationTypes.Linear); float minRot = UtilityGlobals.ToRadians(MinRotation); float maxRot = UtilityGlobals.ToRadians(MaxRotation); Rotation = UtilityGlobals.PingPong(ElapsedTime / RotateTime, minRot, maxRot); }
protected override void ReadInput() { //If we're past the run time, check if the bar is past the cursor if (ElapsedTime >= TimeToFill) { //Default to a fail CommandResults results = CommandResults.Failure; //If the bar is at or past the cursor, we succeeded if (CurBarValue >= CurCursorVal) { results = CommandResults.Success; } OnComplete(results); return; } ElapsedTime += Time.ElapsedMilliseconds; //Move the cursor UpdateCursorVal(); //If the bar's not full, handle deceleration and check for input if (IsBarFull == false) { //Make the bar go down by a certain amount FillBar(-DecelerationRate, true); if (AutoComplete == true || Input.GetKeyDown(ButtonToPress) == true) { FillBar(AmountPerPress, true); } } else { //Interpolate the color of the bar float colorVal = UtilityGlobals.PingPong(ElapsedTime / 300f, .3f, 1f); BarFillColor = new Color(colorVal, colorVal, colorVal, 1f); } }
protected override void ReadInput() { ElapsedTime += Time.ElapsedMilliseconds; if (ElapsedTime >= TimeToFill) { //Send a response with the percentage of the bar filled //Automatically mark it as a success //Air Lift's Action Command doesn't send a CommandRank (or at least, it doesn't display it in PM) SendResponse(CurBarValue / MaxBarValue * 100d); OnComplete(CommandResults.Success); return; } //If the bar's not full, handle deceleration and check for input if (IsBarFull == false) { //Make the bar go down by a certain amount if it's past the minimum value if (CurBarValue > MinBarValue) { FillBar(-DecelerationRate, true); } if (AutoComplete == true || Input.GetKeyDown(ButtonToPress) == true) { //Fill the bar FillBar(AmountPerPress, true); } } else { //Interpolate the color of the bar float colorVal = UtilityGlobals.PingPong(ElapsedTime / 300f, .3f, 1f); BarFillColor = new Color(colorVal, colorVal, colorVal, 1f); } }
private void UpdateCursorVal() { //Move the cursor CurCursorVal = UtilityGlobals.PingPong((ElapsedTime + RandTimeOffset) / (CursorMoveTime / MaxBarValue), MaxBarValue); }