public void Update() { if ((int)type == (int)BarType.e_MovingObject) { float ratio = Utilities.GetRatioP1P2(displayFillLevel, 0, fillMaximum); position = Utilities.GetPositionBetweenP1P2(ratio, startPosition, endPosition); zobject.SetScreenPosition(position); zobject.Update(); } if (state != ZbarStateEnum.kZbarState_Shown) { { state = ZbarStateEnum.kZbarState_Shown; } } else { displayFillLevel = displayFillLevel + ((fillLevel - displayFillLevel) * 0.2f); } }
public CGPoint GetPosition() { Globals.Assert((target == InterpolationTarget.kInterp_Screen) || (target == InterpolationTarget.kInterp_Map)); return(Utilities.GetPositionBetweenP1P2(this.GetValue(), startPosition, endPosition)); }
public void Update(ZRMUpdateData inData) { int[] realRacePos = new int[(int)Enum.kMaxNumTeams]; float[] tempRacePosition = new float[(int)Enum.kMaxNumTeams]; for (int team = 0; team < numTeams; team++) { realRacePos [team] = (int)inData.racePos [team]; markerPosition [team] = Utilities.GetRatioP1P2(realRacePos [team], raceFrom, raceTo); overTakeThisFrame [team] = false; overTakeThisFramePlayer [team] = false; } if (numTeams > 1) { float[] inFrontBy = new float[(int)Enum.kMaxNumTeams]; float[] inFrontByReal = new float[(int)Enum.kMaxNumTeams]; for (int playerPair = 0; playerPair < (numTeams - 1); playerPair++) { int frontPlayer = playerPosition[playerPair]; int behindPlayer = playerPosition[playerPair + 1]; inFrontBy[playerPair] = markerPosition[frontPlayer] - markerPosition[behindPlayer]; inFrontByReal[playerPair] = realRacePos[frontPlayer] - realRacePos[behindPlayer]; } for (int i = 0; i < numTeams - 1; i++) { markerPosition[playerPosition[i + 1]] -= (markerSize * ((float)(i + 1))); } int behindPlayer8 = playerPosition[numTeams - 1]; if (markerPosition[behindPlayer8] < 0.0f) { float offBottomBy = -markerPosition[behindPlayer8]; for (int i = 0; i < (numTeams - 1); i++) { markerPosition[playerPosition[i]] += offBottomBy; tempRacePosition[playerPosition[i]] = markerPosition[playerPosition[i]]; } markerPosition[behindPlayer8] = 0.0f; tempRacePosition[behindPlayer8] = markerPosition[behindPlayer8]; } else { for (int i = 0; i < numTeams; i++) { tempRacePosition[i] = markerPosition[i]; } } for (int playerPair = 0; playerPair < (numTeams - 1); playerPair++) { int frontPlayer = playerPosition[playerPair]; int behindPlayer = playerPosition[playerPair + 1]; if ((inFrontByReal[playerPair] <= overtakeDistance) && (playerState[behindPlayer] == RMPlayerState.kRMPlayer_Free) && (playerState[ frontPlayer] == RMPlayerState.kRMPlayer_Free)) { this.StartOvertakeP1(behindPlayer, frontPlayer); } if (overTakingTimer[behindPlayer] > 0.0f) { overTakingTimer[behindPlayer] -= Constants.kFrameRate; float ratio = 1.0f - Utilities.GetRatioP1P2(overTakingTimer[behindPlayer], 0.0f, overTakeTime); tempRacePosition[behindPlayer] += ratio * markerSize; tempRacePosition[frontPlayer] -= ratio * markerSize; if (overTakingTimer[behindPlayer] <= 0.0f) { int pos = playerPosition[playerPair]; playerPosition[playerPair] = playerPosition[playerPair + 1]; playerPosition[playerPair + 1] = pos; playerState[frontPlayer] = RMPlayerState.kRMPlayer_Free; playerState[behindPlayer] = RMPlayerState.kRMPlayer_Free; markerPosition[behindPlayer] += markerSize; markerPosition[frontPlayer] -= markerSize; } } } } else { tempRacePosition[0] = markerPosition[0]; } for (int team = 0; team < numTeams; team++) { CGPoint markerScreenPos = Utilities.CGPointMake(0, 0); if (useLocator) { } else { markerScreenPos = Utilities.GetPositionBetweenP1P2(tempRacePosition[playerPosition[team]], raceMarkerStartPos, raceMarkerFinishPos); } int displayPos = team; if (playerState[playerPosition[team]] == RMPlayerState.kRMPlayer_Overtaking) { displayPos -= 1; } else if (playerState[playerPosition[team]] == RMPlayerState.kRMPlayer_BeingOvertaken) { displayPos += 1; } (pMarker[playerPosition[team]]).SetScreenPosition(markerScreenPos); (pMarker[playerPosition[team]]).Update(); } }