/// <summary> /// Initialize the scenario. /// </summary> /// <param name="device"></param> /// <param name="Width"></param> /// <param name="Height"></param> public void Initialize(IDevice device, int Width, int Height) { try { this.device = device; BackGround = new AnimationObject(device, Properties.Resources.AppleBack); Apple = new AnimationObject(device, new PointF((Width - Properties.Resources.Apple.Width) / 2, (Height - Properties.Resources.Apple.Height) * 0.871f), new PointF((Width - Properties.Resources.Apple.Width) / 2, (Height - Properties.Resources.Apple.Height) * 0.18f), Properties.Resources.Apple); PointF BoyPosition = new PointF((Width - Properties.Resources.Boy.Width) / 2, Height - Properties.Resources.Boy.Height); Boy = new AnimationObject(device, BoyPosition); BoySadTexture = GraphicEngine.GraphicEngine.CreateTexture(device, Properties.Resources.BoyDep); BoyHappyTexture = GraphicEngine.GraphicEngine.CreateTexture(device, Properties.Resources.Boy); BoySuccessTexture = GraphicEngine.GraphicEngine.CreateTexture(device, Properties.Resources.Boy2); PointF BoyHandPosition = new PointF(60 + BoyPosition.X, 52 + BoyPosition.Y); BoyHand = new AnimationObject(device, BoyHandPosition, Properties.Resources.hand); BoyHand.RotateOrigin = new PointF(0.1f, 0.92f); BoyHand.RotateAngle = 0.046f; BirdsList = new List <AnimationObject>(); //! Create and add to list birds. CreateBirdAndAddToScenario(device, Width, Height, 315, 5, 783, 828); CreateBirdAndAddToScenario(device, Width, Height, 670, 95, 190, 880); CreateBirdAndAddToScenario(device, Width, Height, 400, 3, 736, 908); CreateBirdAndAddToScenario(device, Width, Height, 455, 2, 806, 903); CreateBirdAndAddToScenario(device, Width, Height, 612, 95, 869, 920); CreateBirdAndAddToScenario(device, Width, Height, 563, 90, 240, 770); CreateBirdAndAddToScenario(device, Width, Height, 355, 4, 253, 860); CreateBirdAndAddToScenario(device, Width, Height, 511, 90, 882, 731); CreateBirdAndAddToScenario(device, Width, Height, 460, 89, 682, 900); CreateBirdAndAddToScenario(device, Width, Height, 258, 5, 850, 823); } catch (Exception ex) { xPFT.Exceptions.ExceptionHandler.LogError(ex); } }
/// <summary> /// Initialize the scenario. /// </summary> /// <param name="device"></param> /// <param name="Width"></param> /// <param name="Height"></param> public void Initialize(IDevice device, int Width, int Height) { try { this.device = device; BackGround = new AnimationObject(device, Properties.Resources.Background03); float BallonPositionX = (Width - Properties.Resources._01b.Width) / 2; float BallonPositionY = (Height - Properties.Resources._01b.Height); Ballon = new AnimationObject(device, new PointF(BallonPositionX, BallonPositionY * 0.94f), new PointF(BallonPositionX, BallonPositionY * 0.19f), Properties.Resources.B10); txuUperBallon = GraphicEngine.GraphicEngine.CreateTexture(device, Properties.Resources._03b); txuDownerBallon = GraphicEngine.GraphicEngine.CreateTexture(device, Properties.Resources._01b); Bough = new AnimationObject(device, new PointF((Width - Properties.Resources.Bough.Width) / 2, Height - Properties.Resources.Bough.Height), Properties.Resources.Bough); BirdsList = new List <AnimationObject>(); CreateBirdAndAddToScenario(device, Width, Height, 415, 0, 130, 720); CreateBirdAndAddToScenario(device, Width, Height, 572, 0, 925, 750); CreateBirdAndAddToScenario(device, Width, Height, 555, 80, 755, 735); CreateBirdAndAddToScenario(device, Width, Height, 511, 80, 780, 862); CreateBirdAndAddToScenario(device, Width, Height, 500, 0, 878, 850); CreateBirdAndAddToScenario(device, Width, Height, 336, 80, 50, 670); CreateBirdAndAddToScenario(device, Width, Height, 455, 80, 825, 680); CreateBirdAndAddToScenario(device, Width, Height, 398, 80, -9, 348); CreateBirdAndAddToScenario(device, Width, Height, 300, 0, 75, 455); CreateBirdAndAddToScenario(device, Width, Height, 358, 0, 120, 580); } catch (Exception ex) { xPFT.Exceptions.ExceptionHandler.LogError(ex); } }
/// <summary> /// Create bird and add to the scenario. /// </summary> /// <param name="scenario"></param> /// <param name="X1">movement start point X</param> /// <param name="Y1">movement start point Y</param> /// <param name="X2">movement end point X</param> /// <param name="Y2">movement end point Y</param> private void CreateBirdAndAddToScenario(IDevice device, int Width, int Height, float X1, float Y1, float X2, float Y2) { AnimationObject bird = new AnimationObject(device, new PointF(Width * X1 / 1000, Height * Y1 / 1000), new PointF(Width * X2 / 1000, Height * Y2 / 1000), Properties.Resources.B10); BirdsList.Add(bird); }