public override void Load() { base.Load(); var pauseButton = this.GameObjects.First(g => g.Name.ToLower().Contains("pause")); var buttonAnimation = new PropertyAnimationComponent(); buttonAnimation.Property = "Scale"; buttonAnimation.StartValue = "1,1,1"; buttonAnimation.StopValue = "1.1,1.1,1"; buttonAnimation.DurationSeconds = 0.2f; pauseButton.AddComponent(buttonAnimation); pauseButton.OnMouseDown += new EventHandler<Engine.Events.MouseButtonDownEvent>(pauseButton_OnMouseDown); pauseButton.OnMouseUp += new EventHandler<Engine.Events.MouseButtonUpEvent>(pauseButton_OnMouseUp); pauseButton.OnMouseOut += new EventHandler<Engine.Events.MouseOutEvent>(pauseButton_OnMouseOut); _starTextComponent = GameObjects.First(g => g.Name == "StarCount").Components.First(c => c is TextComponent) as TextComponent; _game = this.Game as TestGame; var gameOver = this.GameObjects.First(g => g.Name == "Gameover"); gameOver.Visible = false; gameOver.Enabled = false; gameOver.OnMouseDown += (a, b) => { var overlay = this.GameObjects.Single(g => g.Name == "Overlay"); overlay.Visible = false; gameOver.Visible = false; gameOver.Enabled = false; ((TestGame)this.Game).ReloadScene(); }; }
public void StartAnimating() { if (IsAnimating) return; CreateFrameBuffer (); CADisplayLink displayLink = UIScreen.MainScreen.CreateDisplayLink (this, new Selector ("drawFrame")); displayLink.FrameInterval = frameInterval; displayLink.AddToRunLoop (NSRunLoop.Current, NSRunLoop.NSDefaultRunLoopMode); this.displayLink = displayLink; IsAnimating = true; _game = new TestGame(_iOSGL); _game.Resize(this.Size.Width, this.Size.Height); _game.Load(); GL.Enable(EnableCap.DepthTest); }