public FlySpawnSystem(FrameTime time, PondSimState pond, FlyData flyData) { mPond = pond; mFlyData = flyData; mTime = time; mRandom = new Random(); }
public FlyDirectionSystem(FrameTime time, PondSimState pond, FlyData flyData, FlyDirectionChangeData changeData) { mTime = time; mPond = pond; mFlyData = flyData; mChangeData = changeData; mRandom = new Random(); }
public WetDryFrogSystem(PondSimState pond) { mPond = pond; const int kExpectedFrogCount = 4; mSplashingInFrogs = new List <Entity>(kExpectedFrogCount); mSplashingOutFrogs = new List <Entity>(kExpectedFrogCount); }
public LilyCollisionSystem(PondSimState pond) { const int kExpectedFrogCount = 4; //TODO: Data drive or at least manage at a higher level! mPond = pond; mLandingFrogs = new List <Entity>(kExpectedFrogCount); mLandingPositions = new List <Vector2>(kExpectedFrogCount); mLandingRects = new List <Rect>(kExpectedFrogCount); }
private void SetupCamera(GraphicsDevice device, PondSimState pond) { float pondWidth = pond.Width; float pondHeight = pond.Height; float aspectRatio = device.Adapter.CurrentDisplayMode.AspectRatio; Matrix translation = Matrix.CreateTranslation(-aspectRatio * pondHeight * 0.5f, -pondHeight * 0.5f, 0f); Matrix projectionMatrix = Matrix.CreateOrthographic(aspectRatio * pondHeight, pondHeight, -100, 100); mCameraMatrix = translation * projectionMatrix; }
public RenderSystem(GraphicsDevice graphicsDevice, PondSimState pond, Texture2D frogSprite, SpriteFont uiFont, FrogAnimationData animationData) { mRenderer = new PrimitiveRenderer(); mRenderer.Setup(graphicsDevice); mFrogRenderer = new FrogRenderer(); mFrogRenderer.Setup(graphicsDevice, frogSprite, animationData); mUIFont = uiFont; mPond = pond; mDevice = graphicsDevice; SetupCamera(graphicsDevice, pond); mUISpriteBatch = new SpriteBatch(mDevice); }
public WaterSystem(FrameTime time, PondSimState pond) { mPond = pond; mTime = time; for (int i = 0; i < mWaterHeight.Length; ++i) { mWaterHeight[i] = mPond.WaterLevel; } for (int i = 0; i < mWaterFlow.Length; ++i) { mWaterFlow[i] = 0f; } mPond.WaterPositions = mWaterHeight; mPond.WaterVelocities = mWaterFlow; mWaterDX = mPond.Width / (kWaterResolution - 1); }
public SwimingFrogPhysicsSystem(FrameTime frameTime, PondSimState pond, Data.FrogData frogData) { mTime = frameTime; mPond = pond; mSwimData = new FrogSwimData(frogData); }
private static Vector2 ComputeBuouyancyAcceleration(Rect frogRect, float frogDensity, PondSimState pondState) { float volumePercentage = (pondState.WaterLevel - frogRect.MinY) / (frogRect.Height); volumePercentage = MathExtensions.Clamp01(volumePercentage); return((frogDensity - volumePercentage) * PondSimState.kGravity); }