Пример #1
0
        private void StartLevelInitialize(LevelEngine levelEngine)
        {
            ActivateScreen(screenLoading);

            loadingLevel = levelEngine;
            Action action = loadingLevel.Initialize;

            loadingResult = action.BeginInvoke(null, null);
        }
Пример #2
0
        public void LoadLevel(XLevelInfo levelInfo)
        {
#if IPHONE
            MonoTouch.UIKit.UIApplication.SharedApplication.BeginIgnoringInteractionEvents();
#endif
            var levelEngine = new LevelEngine(this, levelInfo, this.ScoreFile.LevelScoreDict[levelInfo.Id]);
            levelEngine.Owner = this.ScreenEngine;

            StartLevelInitialize(levelEngine);
        }
Пример #3
0
        public override bool ProcessCollision(LevelEngine level, System.Drawing.RectangleF intersect)
        {
			switch (this.Edges)
			{
				case XEdgeType.None : break;
				case XEdgeType.Bounce : {

					var sb = this.GetScreenBounds();

					if (level.Hero.DirectionX > 0)
						level.Hero.Bounds.X = sb.Left - level.Hero.Bounds.Width - (level.Hero.Bounds.Right - sb.Left);
					else if (level.Hero.DirectionX < 0)
						level.Hero.Bounds.X = sb.Right + sb.Right - level.Hero.Bounds.Left;
					else if (level.Hero.DirectionY > 0)
						level.Hero.Bounds.Y = sb.Top - level.Hero.Bounds.Height - (level.Hero.Bounds.Bottom - sb.Top);
					else if (level.Hero.DirectionY < 0)
						level.Hero.Bounds.Y = sb.Bottom + sb.Bottom - level.Hero.Bounds.Top;

					// change hero's direction
					level.Hero.Direction = level.Hero.Direction.Reverse();
					
					this.EnqueueEvent(level.Hero.Id + ":bounce");
				}; break;
				case XEdgeType.Stick : {
					var sb = this.GetScreenBounds();

					if (level.Hero.DirectionX > 0)
						level.Hero.Bounds.X = sb.Left - level.Hero.Bounds.Width;
					else if (level.Hero.DirectionX < 0)
						level.Hero.Bounds.X = sb.Right;
					else if (level.Hero.DirectionY > 0)
						level.Hero.Bounds.Y = sb.Top - level.Hero.Bounds.Height;
					else if (level.Hero.DirectionY < 0)
						level.Hero.Bounds.Y = sb.Bottom;

					level.Hero.Direction = Direction.VectorStop;

					this.EnqueueEvent(level.Hero.Id + ":stick");
				}; break;
				case XEdgeType.Teleport : break;
			}
			
			return true;
        }
Пример #4
0
        public void FinishLoadLevel()
        {
            // remove "Loading..."
            DismissCurrentScreen();


            if (this.ScreenEngine != loadingLevel)
            {
                if (this.ScreenEngine is LevelEngine)
                {
                    CloseCurrentScreen();
                }

                ActivateScreen(loadingLevel, false);
            }

            loadingLevel  = null;
            loadingResult = null;
        }
Пример #5
0
        public virtual bool ProcessCollision(LevelEngine level, System.Drawing.RectangleF intersect)
        {
			return false;
        }