public PondSimState(PondData data) { Width = data.Width; Height = data.Height; WaterLevel = data.WaterLevel; if (data.Lilies != null) { Lilies = new List <LilyPadSimState>(data.Lilies.Length); foreach (var lilyData in data.Lilies) { LilyPadSimState lilyState = new LilyPadSimState(lilyData.LilyPad, new Vector2(lilyData.HorizontalPosition, data.WaterLevel)); Lilies.Add(lilyState); } } }
void SetPondUI() { for (int id = 0; id < pondDataList.pondfish.Count; id++) { PondData tempData = pondDataList.pondfish[id]; if (tempData.maxLength < 0) { pondUIList[id].SetBlock(true); pondUIList[id].SetButton(false); continue; } //未捕获过该鱼 pondUIList[id].SetName(tempData.name); pondUIList[id].SetLength(tempData.maxLength); pondUIList[id].SetWeight(tempData.maxWeight); pondUIList[id].SetScore(tempData.score); } }
protected override void LoadContent() { FrogData frogData = Content.Load <FrogData>("Frog"); PondData pondData = Content.Load <PondData>("Pond"); FlyData flyData = Content.Load <FlyData>("Fly"); FlyDirectionChangeData changeData = Content.Load <FlyDirectionChangeData>("DirectionChange"); FlyNoiseData noiseData = Content.Load <FlyNoiseData>("FlyNoise"); FrogAnimationData animationData = Content.Load <FrogAnimationData>("FrogAnimation"); Texture2D frogSprite = Content.Load <Texture2D>("Ranita"); SpriteFont uiFont = Content.Load <SpriteFont>("GameUI"); System.Diagnostics.Debug.Assert(IsFixedTimeStep); RanitasDependencies dependencies = new RanitasDependencies((float)TargetElapsedTime.TotalSeconds, pondData, frogData, flyData, changeData, noiseData, animationData, frogSprite, mGraphics.GraphicsDevice, uiFont); mSim = new ECSSim(dependencies); mSim.Initialize(); }
void SetFish() { for (int id = 0; id < pondDataList.pondfish.Count; id++) { PondData tempData = pondDataList.pondfish[id]; if (tempData.maxLength < 0) { Destroy(fishList[id]); Debug.Log("destroy" + fishList[id]); continue; } //未捕获过该鱼 GameObject obj = fishList[id]; //obj.GetComponent<TFObject>().SetTFObject(tempData.maxLength , tempData.maxWeight,tempData.speed); PondFishMovement pfm = obj.AddComponent <PondFishMovement>(); pfm.speed = tempData.speed; Debug.Log("生成了一条" + tempData.maxLength.ToString("f2") + "cm," + tempData.maxWeight.ToString("f2") + "kg的" + tempData.name); } }
public FrogFactory(FrogData frogData, PondData pondData) { mFrogData = frogData; mPondData = pondData; }