public void StopStateInterpolation(TurretColor stateToStop) { switch (stateToStop) { case TurretColor.Orange: break; case TurretColor.Red: break; case TurretColor.Green: break; case TurretColor.Olive: break; } CurrentTurretColorState = stateToStop; }
public void InterpolateBetween(TankColor firstState, TankColor secondState, float interpolationValue) { #if DEBUG if (float.IsNaN(interpolationValue)) { throw new System.Exception("interpolationValue cannot be NaN"); } #endif bool setTurretInstanceCurrentTurretColorState = true; Entities.Turret.TurretColor TurretInstanceCurrentTurretColorStateFirstValue = GreasyPlatypusSlapper.Entities.Turret.TurretColor.Orange; Entities.Turret.TurretColor TurretInstanceCurrentTurretColorStateSecondValue = GreasyPlatypusSlapper.Entities.Turret.TurretColor.Orange; switch (firstState) { case TankColor.Orange: if (interpolationValue < 1) { this.SpriteInstanceCurrentChainName = "OrangeBody"; } TurretInstanceCurrentTurretColorStateFirstValue = GreasyPlatypusSlapper.Entities.Turret.TurretColor.Orange; break; case TankColor.Red: if (interpolationValue < 1) { this.SpriteInstanceCurrentChainName = "RedBody"; } TurretInstanceCurrentTurretColorStateFirstValue = GreasyPlatypusSlapper.Entities.Turret.TurretColor.Red; break; case TankColor.Green: if (interpolationValue < 1) { this.SpriteInstanceCurrentChainName = "GreenBody"; } TurretInstanceCurrentTurretColorStateFirstValue = GreasyPlatypusSlapper.Entities.Turret.TurretColor.Green; break; case TankColor.Olive: if (interpolationValue < 1) { this.SpriteInstanceCurrentChainName = "OliveBody"; } TurretInstanceCurrentTurretColorStateFirstValue = GreasyPlatypusSlapper.Entities.Turret.TurretColor.Olive; break; } switch (secondState) { case TankColor.Orange: if (interpolationValue >= 1) { this.SpriteInstanceCurrentChainName = "OrangeBody"; } TurretInstanceCurrentTurretColorStateSecondValue = GreasyPlatypusSlapper.Entities.Turret.TurretColor.Orange; break; case TankColor.Red: if (interpolationValue >= 1) { this.SpriteInstanceCurrentChainName = "RedBody"; } TurretInstanceCurrentTurretColorStateSecondValue = GreasyPlatypusSlapper.Entities.Turret.TurretColor.Red; break; case TankColor.Green: if (interpolationValue >= 1) { this.SpriteInstanceCurrentChainName = "GreenBody"; } TurretInstanceCurrentTurretColorStateSecondValue = GreasyPlatypusSlapper.Entities.Turret.TurretColor.Green; break; case TankColor.Olive: if (interpolationValue >= 1) { this.SpriteInstanceCurrentChainName = "OliveBody"; } TurretInstanceCurrentTurretColorStateSecondValue = GreasyPlatypusSlapper.Entities.Turret.TurretColor.Olive; break; } if (setTurretInstanceCurrentTurretColorState) { TurretInstance.InterpolateBetween(TurretInstanceCurrentTurretColorStateFirstValue, TurretInstanceCurrentTurretColorStateSecondValue, interpolationValue); } if (interpolationValue < 1) { mCurrentTankColorState = (int)firstState; } else { mCurrentTankColorState = (int)secondState; } }