예제 #1
0
        public override void DrawBackground()
        {
            List <Entity> NewEntities = viewPort.Render();

            foreach (Entity e in NewEntities)
            {
                Entity c = null;

                switch (e.Name)
                {
                case "ground": c = new Characters.Ground(this.gameObject); break;

                case "brick": c = new Characters.Brick(this.gameObject); break;

                case "pipeleftup": c = new Characters.Pipeleftup(this.gameObject); break;

                case "piperightup": c = new Characters.Piperightup(this.gameObject); break;

                case "pipeleft": c = new Characters.Pipeleft(this.gameObject); break;

                case "piperight": c = new Characters.Piperight(this.gameObject); break;

                case "coinbox": c = new Characters.CoinBox(this.gameObject); break;

                case "emptycoinbox": c = new Characters.EmptyCoinBox(this.gameObject); break;

                case "coinbounce": c = new Characters.CoinBounce(this.gameObject); break;

                case "block": c = new Characters.Block(this.gameObject); break;

                case "goomba": c = new Characters.Goomba(this.gameObject); break;

                case "koopatroopa": c = new Characters.KoopaTroopa(this.gameObject); break;
                }

                c.X             = e.X;
                c.Y             = e.Y;
                c.OriginTileCol = e.OriginTileCol;
                c.OriginTileRow = e.OriginTileRow;

                var xx = Entities.Where(x => x.OriginTileRow == c.OriginTileRow && x.OriginTileCol == c.OriginTileCol);
                if (xx.Count() == 0)
                {
                    Entities.Add(c);
                }
            }

            NewEntities.Clear();
        }
예제 #2
0
파일: MainScene.cs 프로젝트: saimib/Mario
        public override void DrawBackground()
        {
            List <Entity> NewEntities = viewPort.Render();

            foreach (Entity e in NewEntities)
            {
                CharacterEntity c = null;

                switch (e.Name)
                {
                case "goomba": c = new Characters.Goomba(this._gameObject); break;

                case "koopatroopa": c = new Characters.KoopaTroopa(this._gameObject); break;

                case "coinbox": c = new Characters.CoinBox(this._gameObject); break;

                case "emptycoinbox": c = new Characters.EmptyCoinBox(this._gameObject); break;

                case "rock": c = new Characters.Rock(this._gameObject); break;

                case "brick": c = new Characters.Brick(this._gameObject); break;

                case "block": c = new Characters.Block(this._gameObject); break;

                case "goal": c = new Characters.Goal(this._gameObject); break;

                case "pipetopleft": c = new Characters.PipeTopLeft(this._gameObject); break;

                case "pipetopright": c = new Characters.PipeTopRight(this._gameObject); break;

                case "pipeleft": c = new Characters.PipeLeft(this._gameObject); break;

                case "piperight": c = new Characters.PipeRight(this._gameObject); break;

                case "flagpole": c = new Characters.FlagPole(this._gameObject); break;

                case "flag": c = new Characters.Flag(this._gameObject); break;

                case "poletop": c = new Characters.PoleTop(this._gameObject); break;

                case "smallcastle": c = new Characters.SmallCastle(this._gameObject); break;

                case "coin": c = new Characters.Coin(this._gameObject); break;

                case "coinbounce": c = new Characters.CoinBounce(this._gameObject); break;
                }

                c.X             = e.X;
                c.Y             = e.Y;
                c.OriginTileCol = e.OriginTileCol;
                c.OriginTileRow = e.OriginTileRow;

                var xx = Entities.Where(x => x.OriginTileRow == c.OriginTileRow && x.OriginTileCol == c.OriginTileCol);
                if (xx.Count() == 0)
                {
                    Entities.Add(c);
                }
            }

            NewEntities.Clear();
        }