• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# GameEngine类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中GameEngine的典型用法代码示例。如果您正苦于以下问题:C# GameEngine类的具体用法?C# GameEngine怎么用?C# GameEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GameEngine类属于命名空间,在下文中一共展示了GameEngine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Main

 static void Main()
 {
     using (var game = new GameEngine())
     {
         game.Run();
     }
 }
开发者ID:BadassGamingCrew,项目名称:Chess-Might-and-Magic,代码行数:7,代码来源:EntryPoint.cs


示例2: TestWeights

        // Runs expectimax searches to test the weights of the chromosome
        private double TestWeights()
        {
            double total = 0;
            ConcurrentBag<double> subTotals = new ConcurrentBag<double>();

            Parallel.For(0, NUM_THREADS, j =>
            {
                double subtotal = 0;
                for (int i = 0; i < NUM_TESTS / NUM_THREADS; i++)
                {
                    GameEngine gameEngine = new GameEngine();
                    Expectimax expectimax = new Expectimax(gameEngine, 2);
                    State end = expectimax.RunStar1WithUnlikelyPruning(false, chromosome);
                    double points = end.Points;
                    subtotal += points;

                }
                subTotals.Add(subtotal);
            });
            foreach (double sub in subTotals)
            {
                total += sub;
            }
            num_tests += NUM_TESTS;
            return total;
        }
开发者ID:kstrandby,项目名称:2048-AI,代码行数:27,代码来源:WeightVectorChromosome.cs


示例3: PlayerNameState

        public PlayerNameState(GameEngine engine, MainMenuState ms)
        {
            eng = engine;
            mouse = eng.Mouse;
            savedGameStates = new Stack<XmlNodeList>();
            savedGameChoices = new Stack<string>();
            _ms = ms;

            Assembly assembly = Assembly.GetExecutingAssembly();
            
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            lookat = new Vector3(0, 0, 2);
            eye = new Vector3(0, 0, 5);

            _old_state = OpenTK.Input.Keyboard.GetState(); // Get the current state of the keyboard

            eng.StateTextureManager.LoadTexture("menu", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.menu.png"));
            menu = eng.StateTextureManager.GetTexture("menu");

            saveFont = QFont.FromQFontFile("Fonts/myHappySans.qfont", new QFontLoaderConfiguration(true));
            saveFont.Options.DropShadowActive = true;

            start_x = saveFont.Measure("Name: ").Width;

            //title = QFont.FromQFontFile("myHappySans.qfont", new QFontLoaderConfiguration(true));
            title = QFont.FromQFontFile("Fonts/myRock.qfont", new QFontLoaderConfiguration(true));
            title.Options.DropShadowActive = true;

            name = "";          

            numOfButtons = savedGameChoices.Count - 1;
        }
开发者ID:Munk801,项目名称:Journey-to-the-West-Video-Game,代码行数:33,代码来源:PlayerNameState.cs


示例4: TradeManager

 public TradeManager(GameState gamestate, GameEngine ge)
 {
     this.gamestate = gamestate;
     gameengine = ge;
     this.numProposedTrades = 0;
     this.numSuccessfulTrades = 0;
 }
开发者ID:Gabino3,项目名称:socAI,代码行数:7,代码来源:TradeManager.cs


示例5: Init

        public override void Init(GameEngine game)
        {
            base.Init(game);
            List<SFML.Graphics.Text> protptypeLabel = new List<SFML.Graphics.Text>();
            List<Type> prototypeStates = new List<Type>();

            Assembly assembly = Assembly.GetExecutingAssembly();

            Type[] classes = assembly.GetTypes();
            int i =0;
            foreach (Type t in classes)
            {
                if (t.BaseType.Name.Equals("IPrototype"))
                {
                    SFML.Graphics.Text text = new SFML.Graphics.Text(i+". :"+t.Name);
                    text.Position = new SFML.Window.Vector2f(50, 20 + i * 30);
                    protptypeLabel.Add(text);
                    prototypeStates.Add(t);
                    i++;
                }
            }

            _prototypeLabels = protptypeLabel.ToArray<SFML.Graphics.Text>();
            _prototypeStates = prototypeStates.ToArray<Type>();
        }
开发者ID:floAr,项目名称:BeyondTheBlur,代码行数:25,代码来源:PickPrototypeState.cs


示例6: StartGame

 public void StartGame()
 {
     //this.simpleSound.Stop();
     KeyboardController keyboardController = new KeyboardController();
     GameEngine game = new GameEngine(keyboardController);
     game.Run();
 }
开发者ID:Team-Utapau,项目名称:OOP-Project,代码行数:7,代码来源:MainGameMenu.cs


示例7: Main

 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (GameEngine game = new GameEngine(800, 640, true))
     {
         game.Run();
     }
 }
开发者ID:akbiggs,项目名称:Trauma,代码行数:10,代码来源:Program.cs


示例8: OpenTKWindow

        public OpenTKWindow(GameEngine engine)
            : base(800, 600, new GraphicsMode(32, 24, 0, 2), "ORTS.Test")
        {
            VSync = VSyncMode.Off;
            Views= new ConcurrentDictionary<Type,IGameObjectView>();
            this.Engine = engine;

            this.Engine.Bus.OfType<LoadObjectView>().Subscribe(m => Views.TryAdd(m.GameObjectType,m.View));
            KeyMap map = new KeyMap();

            Keyboard.KeyDown += (object sender, KeyboardKeyEventArgs e) => {
                this.Engine.Bus.Add(new KeyDown(this.Engine.Timer.LastTickTime, map.Do(e.Key)));
            };
            Keyboard.KeyUp += (object sender, KeyboardKeyEventArgs e) => {
                this.Engine.Bus.Add(new KeyUp(this.Engine.Timer.LastTickTime, map.Do(e.Key)));
            };

            Mouse.WheelChanged += (object sender, MouseWheelEventArgs e) => {
                camera.Translate(new Vect3(0,0,-e.DeltaPrecise));
            };

            engine.Bus.Add(new GraphicsLoadedMessage(engine.Timer.LastTickTime));

            camera = new Camera();
            camera.Translate(new Vect3(0, 0, 30));
        }
开发者ID:veggielane,项目名称:ORTS,代码行数:26,代码来源:OpenTKWindow.cs


示例9: PauseMenuState

        // End Fonts

        public PauseMenuState(GameEngine engine, MainMenuState menustate)
        {
            eng = engine;
            menu = menustate;
            lookat = new Vector3(0, 0, 2);
            eye = new Vector3(0, 0, 5);
//             _p1 = eng.StateTextureManager.GetTexture("p1");
//             _p2 = eng.StateTextureManager.GetTexture("p2");
//             _p3 = eng.StateTextureManager.GetTexture("p3");
//             _p4 = eng.StateTextureManager.GetTexture("p4");

            // QFont
            Assembly assembly = Assembly.GetExecutingAssembly();
            eng.StateTextureManager.LoadTexture("menu", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.menu.png"));
            bg = eng.StateTextureManager.GetTexture("menu");

            _buttons = new List<String>();            
            _buttons.Add("Continue??");
			_buttons.Add("Main Menu");
            _buttons.Add("Quit");
            button = QFont.FromQFontFile("Fonts/myHappySans.qfont", new QFontLoaderConfiguration(true));
            button.Options.DropShadowActive = true;
            //title = QFont.FromQFontFile("myHappySans.qfont", new QFontLoaderConfiguration(true));
            title = QFont.FromQFontFile("Fonts/myRock.qfont", new QFontLoaderConfiguration(true));
            title.Options.DropShadowActive = false;
            buttonHighlight = QFont.FromQFontFile("Fonts/myHappySans2.qfont", new QFontLoaderConfiguration(true));
            buttonHighlight.Options.DropShadowActive = true;
            //QFont.CreateTextureFontFiles("Fonts/Rock.TTF", 48, "myRock"); // Use this to create new Fonts that you will texture
            // End QFonts

			// Set the current image to be displayed at 0 which is the first in the sequence
			curFrame = 0.0;


        }
开发者ID:Munk801,项目名称:Journey-to-the-West-Video-Game,代码行数:37,代码来源:PauseMenuState.cs


示例10: Update

        public override void Update(GameTime gameTime, GameEngine.TeeEngine engine)
        {
            if (Entity.IntersectsWith(this, "Body", Target, "Body", gameTime))
            {
                // Target is hit
                if (Target is NPC)
                {
                    NPC target = (NPC)Target;
                    target.OnHit(this, Damage, gameTime, engine);
                }

                engine.RemoveEntity(this);
            }
            else
            {
                double distance = Vector2.Distance(Pos, MoveTo);

                if (distance < 10)
                {
                    // TODO check for attack succeeding
                    engine.RemoveEntity(this);
                }
                else
                {
                    Pos.X += (float)(Math.Cos(_moveAngle) * Speed);
                    Pos.Y += (float)(Math.Sin(_moveAngle) * Speed);
                }
            }
        }
开发者ID:behindcurtain3,项目名称:TheArena,代码行数:29,代码来源:BeeProjectile.cs


示例11: LoadScreenState

        public LoadScreenState(GameEngine engine, PlayState playstate, int lvl)
        {
            eng = engine;
			this.playstate = playstate;
			this.lvl = lvl;

			doneLoading = false;

            lookat = new Vector3(0, 0, 2);
            eye = new Vector3(0, 0, 5);

			screens = new Texture[8];
			for(int i = 0; i < 8; i++) {
				screens[i] = eng.StateTextureManager.GetTexture("load" + (i + 1));
			}

			// Set the current image to be displayed at 0 which is the first in the sequence
			curFrame = 0.0;

			//Free up any old textures so we have more VRAM available to load new stuff
			for(int i = SpriteSheet.allSprites.Count - 1; i >= 0; i-- ) {
				SpriteSheet.allSprites[i].releaseTexture();
			}

			foreach(int i in SpriteSheet.texIDsToRemove) {
				GL.DeleteTexture(i);
			}
			SpriteSheet.texIDsToRemove.Clear();

			GC.Collect();

			//Start loading in separate thread
			Thread loaderThread = new Thread(new ThreadStart(loadLevel));
			loaderThread.Start();
        }
开发者ID:Munk801,项目名称:Journey-to-the-West-Video-Game,代码行数:35,代码来源:LoadScreenState.cs


示例12: LevelSelect

        public LevelSelect(GameEngine engine) : base(engine)
        {
            eng = engine;
            savedGameStates = new Stack<XmlNodeList>();
            savedGameChoices = new Stack<string>();
            mouse = eng.Mouse;
            // Load all the textures
            eng.StateTextureManager.RenderSetup();
            Assembly assembly = Assembly.GetExecutingAssembly();
            eng.StateTextureManager.LoadTexture("menu", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.menu.png"));
            menu = eng.StateTextureManager.GetTexture("menu");
            eng.StateTextureManager.LoadTexture("arrow", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.arrow.png"));
            arrow = eng.StateTextureManager.GetTexture("arrow");
            eng.StateTextureManager.LoadTexture("load", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_loadlevel.png"));
            load_nopress = eng.StateTextureManager.GetTexture("load");
            eng.StateTextureManager.LoadTexture("loadpress", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_loadlevel_hover.png"));
            load_press = eng.StateTextureManager.GetTexture("loadpress");
            eng.StateTextureManager.LoadTexture("quit", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_exit.png"));
            quit_nopress = eng.StateTextureManager.GetTexture("quit");
            eng.StateTextureManager.LoadTexture("quitpress", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_exit_hover.png"));
            quit_press = eng.StateTextureManager.GetTexture("quitpress");
            eng.StateTextureManager.LoadTexture("play", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_play.png"));
            play_nopress = eng.StateTextureManager.GetTexture("play");
            eng.StateTextureManager.LoadTexture("playpress", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_play_hover.png"));
            play_press = eng.StateTextureManager.GetTexture("playpress");
            eng.StateTextureManager.LoadTexture("ld", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_leveldesign.png"));
            ld_nopress = eng.StateTextureManager.GetTexture("ld");
            eng.StateTextureManager.LoadTexture("ldpress", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_leveldesign_hover.png"));
            ld_press = eng.StateTextureManager.GetTexture("ldpress");

            musicFile = new AudioFile(assembly.GetManifestResourceStream("U5Designs.Resources.Sound.Retribution.ogg"));
            musicFile.Play();

            // Setup saved game data 
            SavedGameDataSetup();

            // Display available saved game states
            DisplayAvailableSaves();

            // Clear the color to work with the SplashScreen so it doesn't white out
            GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            lookat = new Vector3(0, 0, 2);
            eye = new Vector3(0, 0, 5);

            _old_state = OpenTK.Input.Keyboard.GetState(); // Get the current state of the keyboard           

            arX = -150.0f;
            b1Y = 0.0f;
            b2Y = -100.0f;
            b3Y = -200.0f;
            b4Y = -250.0f;

            // TEST //
            enterdown = false;
            LoadSavedState(1);

        }
开发者ID:Munk801,项目名称:Journey-to-the-West-Video-Game,代码行数:59,代码来源:LevelSelect.cs


示例13: SetUp

        public void SetUp()
        {
            var gameEngine = new GameEngine(Substitute.For<ITileSetFactory>());

            gamePlayViewModel = new GamePlayViewModel(gameEngine);

            gamePlayViewModel.StartNewGameCommand.Execute(null);
        }
开发者ID:Code-Invaders,项目名称:Catan,代码行数:8,代码来源:When_switching_players.cs


示例14: GameSky

        public GameSky(GameEngine game, GameCamera camera, string resource, string effect)
            : base(game)
        {
            this.camera = camera;
            this.resource = resource;

            Loaded = false;
        }
开发者ID:draek,项目名称:nibiru-engine,代码行数:8,代码来源:GameSky.cs


示例15: SetupGamer

 private void SetupGamer()
 {
     this.player = new Gamer();
     var form = new GameForm();
     IRenderer renderer = new GuiRenderer(form);
     IInputHandlerer handler = new GuiInputHandlerer();
     this.engine = new GameEngine(renderer, handler);
 }
开发者ID:TheAppleTeam,项目名称:HQC_TeamWork,代码行数:8,代码来源:CheckForHand.cs


示例16: GamePlayViewModel

        public GamePlayViewModel(GameEngine gameEngine)
        {
            this.gameEngine = gameEngine;

            StartNewGameCommand = new RelayCommand<GamePlayViewModel>(x => StartNewGame());

            NextTurnCommand = new RelayCommand<GamePlayViewModel>(x => x.IsGameInProgress, x => NextTurn());
        }
开发者ID:Code-Invaders,项目名称:Catan,代码行数:8,代码来源:GamePlayViewModel.cs


示例17: Setup

 public void Setup()
 {
     _display = new Mock<IGameDisplay>();
     _display.SetupSequence<IGameDisplay, bool>(x => x.PlayAgainMessage()).Returns(true).Returns(true).Returns(false);
     _board = new Mock<IBoard>();
     _playGameHandler = new Mock<PlayGameHandler>();
     _gameEngine = new GameEngine(_display.Object, _board.Object, _playGameHandler.Object);
 }
开发者ID:gaterichard,项目名称:TicTacToe,代码行数:8,代码来源:GameEngineTest.cs


示例18: onAttack

        public override void onAttack(GameEngine.TeeEngine engine, GameTime gameTime)
        {
            BeeProjectile attack = new BeeProjectile(Pos.X, Pos.Y, AttackTarget);
            attack.Damage = Damage;
            engine.AddEntity(attack);

            Stance = AttackStance.Retreating;
        }
开发者ID:behindcurtain3,项目名称:TheArena,代码行数:8,代码来源:Bee.cs


示例19: PostInitialize

        public override void PostInitialize(GameTime gameTime, GameEngine.TeeEngine engine)
        {
            // Todo: this should technically NOT be here.
            this.Pos += new Vector2(Width/2.0f, Height/2.0f);

            LightShader lightShader = (LightShader)engine.GetPostGameShader("LightShader");
            lightShader.LightSources.Add(this);
        }
开发者ID:behindcurtain3,项目名称:Some-2D-RPG,代码行数:8,代码来源:LightSource.cs


示例20: GameTerrain

        public GameTerrain(GameEngine game, GameCamera camera, string resource)
            : base(game)
        {
            this.camera = camera;
            this.resource = resource;

            Loaded = false;
        }
开发者ID:draek,项目名称:nibiru-engine,代码行数:8,代码来源:GameTerrain.cs



注:本文中的GameEngine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# GameEntity类代码示例发布时间:2022-05-24
下一篇:
C# GameDataCacheSet类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap