コード例 #1
0
        public static void Main()
        {
            IRenderer renderer = new ConsoleRenderer();
            IInputHandler inputHandler = new ConsoleInputHandler();
            Engine engine = new Engine(renderer, inputHandler);

            engine.Run();
        }
コード例 #2
0
        internal CommandFactory(Engine engine)
        {
            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }

            this.Engine = engine;
        }
コード例 #3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            GameEngine.Engine engine = new GameEngine.Engine();
            engine.Initialize();

            GridGameObject grid = engine.CreateGameObject <GridGameObject>(newGrid =>
            {
                newGrid.GridSize = new Vector2(3, 3);

                Transform localTransform = Transform.Origin;
                Vector2 offset           = new Vector2(50, 50);
                localTransform.Position  = Vector2.Zero + offset;
                localTransform.Size      = engine.GetViewport().Size - offset * 2;
                newGrid.LocalTransform   = localTransform;

                newGrid.LineWidth = 0.005f;
            });

            engine.Root.AddChild(grid);

            List <Vector2> positions = new List <Vector2>()
            {
                new Vector2(0, 0),
                new Vector2(1, 1),
                new Vector2(2, 2),
            };

            for (int i = 0; i < positions.Count; ++i)
            {
                UnitGameObject unit = engine.CreateGameObject <UnitGameObject>(newUnit =>
                {
                    if (i % 2 == 0)
                    {
                        newUnit.SpritePath = "Assets/character.png";
                    }
                    else
                    {
                        newUnit.SpritePath              = "Assets/topdown.png";
                        newUnit.AnimatedSpritePattern   = "Assets/Units/Knife/unit_knife_{0}.png";
                        newUnit.AnimatedSpriteCount     = 20;
                        newUnit.AnimatedSpriteTotalTime = TimeSpan.FromSeconds(0.5);
                    }
                });
                grid.AddUnit(unit, positions[i]);
            }

            engine.StartSubSystem <CombatInteractionHandler>(newCombatInteractionHandler =>
            {
                newCombatInteractionHandler.Grid = grid;
            });

            engine.Run();
        }
コード例 #4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public GameplayScreen(NetworkSession networkSession)
        {
            this.networkSession = networkSession;

            TransitionOnTime = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            // setup keyboard configs:
            List<KeyConfig> keyConfigs = new List<KeyConfig>();
            keyConfigs.Add(new KeyConfig(Keys.W, Keys.S, Keys.A, Keys.D, Keys.C, Keys.Space));
            keyConfigs.Add(new KeyConfig(Keys.Up, Keys.Down, Keys.Left, Keys.Right, Keys.RightControl, Keys.End));
            //keyConfigs.Add(new KeyConfig(Keys.Q, Keys.E, Keys.R, Keys.T, Keys.Y, Keys.U));

            gameEngine = (networkSession == null) ?
                Engine.CreateLocalEngine(NetworkStateManagementGame.MainGame, keyConfigs) :
                Engine.CreateNetworkedEngine(NetworkStateManagementGame.MainGame, keyConfigs, networkSession);

            gameEngine.Initialize();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: CommName/MauMau
        static void igra()
        {
            GameEngine.Engine game = new GameEngine.Engine(2);

            //while (!game.gameOver())
            game.player1.name = "player 1";
            game.player2.name = "player 2";

            Console.WriteLine(game.player1);
            Console.WriteLine(game.player2);

            //try
            {
                do
                {
                    Console.WriteLine(game.topCard.Boja + " " + game.topCard.Broj + " " + game.boja);
                    Console.WriteLine(game.current);

                    /*Console.WriteLine("Tip poteza: Kupi kartu (1),Kupi kaznenu kartu(2),Promeni boju (8), Baca kartu(16), Kraj Poteza(512) ");
                     * TIG.AV.Karte.TipPoteza tip = (TIG.AV.Karte.TipPoteza)Int32.Parse(Console.ReadLine());
                     * Console.WriteLine("Redni broj karte za bacanje ");
                     * int karta = Int32.Parse(Console.ReadLine());
                     * Console.WriteLine("Boja: unknown (0), Karo(1),Pik(2),Herz(3),Tref(4)");
                     * TIG.AV.Karte.Boja boja = (TIG.AV.Karte.Boja)Int32.Parse(Console.ReadLine());
                     *
                     * game.current.manualPlay(karta, tip, boja);
                     */
                } while (game.Game());
            }

            /*
             * catch (Exception e)
             * {
             *  Console.WriteLine(e.Message);
             *  throw new Exception("ERROR");
             * }
             */
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: mgulubov/SoftUniCourse-OOP
 public static void Main()
 {
     Engine engine = new Engine();
     engine.Run();
 }
コード例 #7
0
 static Engine()
 {
     instance = new Engine();
     instance.Players = new List<Player>();
     instance.Games = new List<Game>();
     instance.Confirure();
 }
コード例 #8
0
 /// <summary>
 /// The main program.
 /// </summary>
 private static void Main()
 {
     var engine = new Engine(ConsoleRenderSingleton.Instance);
     engine.Play();
 }
コード例 #9
0
ファイル: Program.cs プロジェクト: ROSSFilipov/CSharp
 public static void Main()
 {
     //The attack method is modified which results in some discrepancies between the given output in the task description and the program output
     Engine engine = new Engine();
     engine.Run();
 }
コード例 #10
0
ファイル: Program.cs プロジェクト: madmarks/Minesweeper-7
 static void Main(string[] args)
 {
     Engine engine = new Engine(ConsoleRenderSingleton.Instance);
     engine.Play();
 }
コード例 #11
0
ファイル: Engine.cs プロジェクト: STPKITT/OpenNFS1
 public static void Create(Game game, GraphicsDeviceManager graphics)
 {
     Debug.Assert(_instance == null);
     _instance = new Engine(game);
     _instance.EngineStartup(graphics);
 }
コード例 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandFactory"/> class.
        /// </summary>
        /// <param name="engine">The engine.</param>
        public CommandFactory(Engine engine)
        {
            Validator.Validator.CheckIfNull(engine, nameof(engine));

            this.engine = engine;
        }