示例#1
0
        public override void OnLoad()
        {
            Update    += OnUpdate;
            Paint     += OnPaint;
            MouseDown += OnMouseDown;
            Unloaded  += OnUnloaded;

            LayoutRecords = new LayoutRecord(HipsterEngine);
            Planet        = new PlanetStart(HipsterEngine, Width / 2, Height / 4, Height / 8);
            var triangleRadius = Planet.Radius / 4;
            var y = Planet.Transform.Y - Planet.Radius - triangleRadius + 2;

            Triangle     = new Triangle(HipsterEngine, Width / 2, y, triangleRadius);
            LabelTouchMe = new Label(HipsterEngine, Width / 2, Height / 2 + 10, "1234 нажмите на hello", new SKPaint
            {
                Color       = new SKColor(150, 150, 150, 100),
                IsAntialias = true,
                TextAlign   = SKTextAlign.Center,
                Typeface    = Assets.Typeface,
                TextSize    = 20
            }, 1);
            BackgroundColor = new SKColor(50, 50, 50);
            _time           = 0;

            paint = new SKPaint
            {
                IsAntialias = true,
                Color       = new SKColor(0, 0, 0)
            };

            AnimationEndGame = new AnimationFloat();
            AnimationEndGame.Start(255, 0, 5);

            LoadProfile();
        }
示例#2
0
        public override void OnLoad()
        {
            Update    += OnUpdate;
            Paint     += OnPaint;
            MouseDown += OnMouseDown;
            Unloaded  += OnUnloaded;

            LayoutRecords = new LayoutRecord(HipsterEngine);
            LayoutTop     = new LayoutTop(HipsterEngine);
            PlanetStart   = new PlanetStart(HipsterEngine, Width / 2, Height / 4, Height / 8);
            PlanetStart.AngularVelocity = 0.04f;

            HipsterEngine.Particles.AddParticleSystem(new ParticlesControllerFire(HipsterEngine));

            var triangleRadius = PlanetStart.Radius / 4;
            var y = PlanetStart.Transform.Y - PlanetStart.Radius - triangleRadius + 2;

            Triangle = new Triangle(HipsterEngine, Width / 2, y, triangleRadius);
            Triangle.SetPlanet(PlanetStart);

            HipsterEngine.Particles.AddParticleSystem(new TriangleParticlesController(HipsterEngine, Triangle));

            HipsterEngine.Surface.Canvas.Camera.X = -Width / 2;
            HipsterEngine.Surface.Canvas.Camera.Y = Height / 2;
            HipsterEngine.Surface.Canvas.Camera.SetTarget(PlanetStart.Transform.X - Width / 2, PlanetStart.Transform.Y + Height / 4);

            var profile = LoadProfile();

            Map = new MapPlanets(HipsterEngine, Triangle);
            Map.Generate(profile.Level);
            Map.EndGame += TriangleOnEndGame;

            AnimationEndGame = new AnimationFloat();
            AnimationEndGame.Timer.Complated += tick =>
            {
                HipsterEngine.Screens.SetScreen(new MenuScreen());
            };

            LayoutRecords.TextRecord = profile.Balls.ToString();
            PlanetStart.Text         = profile.Level.ToString();

            Background = new ParallaxBackground(HipsterEngine, Triangle);
        }