示例#1
0
 public Animation(MyGame theGame, int startFrame, int endFrame, float intervalInSeconds)
 {
     m_timer          = new PTimer(theGame.TimerManager, null);
     m_startFrame     = startFrame;
     m_endFrame       = endFrame;
     m_timer.Interval = intervalInSeconds;
 }
示例#2
0
 public void Draw(MyGame game, GameTime gameTime)
 {
     //game.spriteBatch.Begin();
     //game.spriteBatch.Draw(texture, FireBallPosition, null, Color.White, 0, Vector2.Zero, .7f, SpriteEffects.None, 0);//fire
     //game.spriteBatch.Begin();
     animatedSprite.Draw(game.spriteBatch, FireBallPosition);
 }
示例#3
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     game = new MyGame(Config.GameEnviroment.Android, Config.ScreenMode.Portrait);
     SetViewFullScreen();
     game.Run();
 }
示例#4
0
        protected void SetUp()
        {
            IGameManager manager = new GameManager
                                   (
                ButtonManager,
                CollisionManager,
                ConfigManager,
                ContentManager,
                DeviceManager,
                ImageManager,
                InputManager,
                QuestionManager,
                RandomManager,
                ResolutionManager,
                ScoreManager,
                ScreenManager,
                SoundManager,
                SpriteManager,
                StorageManager,
                TextManager,
                ThreadManager,
                FileManager,
                Logger
                                   );

            MyGame.Construct(manager);
        }
示例#5
0
 private void CheckResize()
 {
     //not used yet
     if (MyGame.OldX() != game.width || MyGame.OldY() != game.height)
     {
     }
 }
示例#6
0
 private void btnGame_Click(object sender, EventArgs e)
 {
     this.OnClosing(new CancelEventArgs());
     using (var program = new MyGame())
         program.Run();
     this.Close();
 }
示例#7
0
        public override void GameStarted()
        {
            Virtual = new MyGame
            {
                AtDelay    = (h, i) => this.ScheduleCallback(() => h(), i).Stop,
                AtInterval = (h, i) => this.AddTimer(() => h(), i).Stop,
            };

            var StateMap = new Dictionary <MyGame.GameStateEnum, NonobaGameState>
            {
                { MyGame.GameStateEnum.ClosedGameInProgress, NonobaGameState.ClosedGameInProgress },
                { MyGame.GameStateEnum.OpenGameInProgress, NonobaGameState.OpenGameInProgress },
                { MyGame.GameStateEnum.WaitingForPlayers, NonobaGameState.WaitingForPlayers },
            };

            Virtual.GameStateChanged +=
                delegate
            {
                this.SetState(StateMap[Virtual.GameState]);
            };


            // You can explicitly setup how many users are allowed in your game.
            MaxUsers = 8;

            Virtual.GameStarted();
        }
示例#8
0
        public void CanUserBeAttacked_IfItsGamer_ReturnsTrue()
        {
            //Arrange
            MyGame myGame = new MyGame();

            User newUser = new User();

            newUser.IsGamer  = true;
            newUser.UserName = "******";

            Clan newClan = new Clan();

            newClan.ClanName   = "The Best";
            newUser.ClanInfo   = newClan;
            myGame.CurrentUser = newUser;

            //Act
            User newEnemy = new User();

            newEnemy.IsGamer  = true;
            newEnemy.UserName = "******";

            Clan newEnemyClan = new Clan();

            newEnemyClan.ClanName = "SU Guys";
            newEnemy.ClanInfo     = newEnemyClan;


            bool canItBeAttacked =
                myGame.CanUserBeAttacked(newEnemy);

            //Assert
            Assert.IsTrue(canItBeAttacked);
        }
示例#9
0
        public void DidEnemyPunch_IfEnemyPunch_ReturnTrue()
        {
            //Arrange
            MyGame enemy = new MyGame();

            User newEnemy = new User();

            newEnemy.IsGamer  = true;
            newEnemy.UserName = "******";

            Clan enemyClan = new Clan();

            enemyClan.ClanName = "The Worst";
            newEnemy.ClanInfo  = enemyClan;
            enemy.CurrentUser  = newEnemy;

            //Act
            User winner = new User();

            winner.IsGamer  = true;
            winner.UserName = "******";

            Clan newEnemyClan = new Clan();

            newEnemyClan.ClanName = "Rodrigus";
            newEnemy.ClanInfo     = newEnemyClan;


            bool DidEnemyPunch =
                enemy.DidEnemyPunch(newEnemy);

            //Assert
            Assert.IsFalse(DidEnemyPunch);
        }
示例#10
0
        public void KickedEnemy_IfKick_ReturnFalse()
        {
            //Arrange
            MyGame enemy = new MyGame();

            User newEnemy = new User();

            newEnemy.IsGamer  = true;
            newEnemy.UserName = "******";

            Clan enemyClan = new Clan();

            enemyClan.ClanName = "The Worst";
            newEnemy.ClanInfo  = enemyClan;
            enemy.CurrentUser  = newEnemy;

            //Act
            User winner = new User();

            winner.IsGamer  = true;
            winner.UserName = "******";

            Clan newEnemyClan = new Clan();

            newEnemyClan.ClanName = "Rodrigus";
            newEnemy.ClanInfo     = newEnemyClan;


            bool KickedEnemy =
                enemy.KickedEnemy(newEnemy);

            //Assert
            Assert.IsFalse(KickedEnemy);
        }
 public static void Main(string[] args)
 {
     using (var game = new MyGame())
     {
         game.Run();
     }
 }
示例#12
0
 public Sprite(MyGame g, String assetName, Rectangle size )
     : base(g)
 {
     this.Name = assetName;
     this.Position = size.Location.ToVector2();
     this.Size = new Vector2(size.Width, size.Height);
 }
示例#13
0
        public override void MouseMoved(MyGame sender, MouseEventArgs e)
        {
            Vector3 vec = sender.Camera.ScreenToWorldVec(sender.Mouse.MouseAfterMoveP, 0)
                          - sender.Camera.ScreenToWorldVec(sender.Mouse.MouseBeforeMoveP, 0);

            MoveMeshVertex(sender, vec);
        }
示例#14
0
        public BaseManager(Byte[] mapData, ShortChat msg, MyGame psyGame)
        {
            // Load all vars
            m_Lobby             = new Base();
            m_Bases             = new List <Base>();
            this.msg            = msg;
            this.psyGame        = psyGame;
            ran                 = new Random();
            m_Mode              = BaseMode.Shuffle;
            m_SizeMode          = BaseSize.Off;
            m_ShuffleModeQ      = new Queue <int>();
            m_ShuffleModeQCount = 10;
            m_RoundRobinCount   = 0;
            m_BasesInUse        = new List <int>();

            // Byte array tunrned into arrays i can work with
            MapData my_MapInfo = new MapData(mapData);

            // Map scanner. Loads/Configures/Saves Bases
            BaseLoader my_BaseLoader = new BaseLoader(my_MapInfo.TileIDs, my_MapInfo.TileTypes);

            my_BaseLoader.LoadBasesFromMap(m_Bases, m_Lobby);

            // Load next base from default random
            ReShuffleQ(true);
            //getNextBase();
        }
示例#15
0
        public override void LoadContent(MyGame game)
        {
            backgrounds = new List<Background>();

            var fireTextures = new Texture2D[] {
                game.Content.Load<Texture2D>(@"Background\Air\1"),
                game.Content.Load<Texture2D>(@"Background\Air\2"),
                game.Content.Load<Texture2D>(@"Background\Air\3"),
                game.Content.Load<Texture2D>(@"Background\Air\4"),
                game.Content.Load<Texture2D>(@"Background\Air\5"),
                game.Content.Load<Texture2D>(@"Background\Air\6"),
                game.Content.Load<Texture2D>(@"Background\Air\7"),
                game.Content.Load<Texture2D>(@"Background\Air\8"),
                game.Content.Load<Texture2D>(@"Background\Air\9"),
                game.Content.Load<Texture2D>(@"Background\Air\10"),
                game.Content.Load<Texture2D>(@"Background\Air\11"),
                game.Content.Load<Texture2D>(@"Background\Air\12"),
                game.Content.Load<Texture2D>(@"Background\Air\13"),
                game.Content.Load<Texture2D>(@"Background\Air\14"),
                game.Content.Load<Texture2D>(@"Background\Air\15"),
                game.Content.Load<Texture2D>(@"Background\Air\16"),
            };
            backgrounds.Add(new BackgroundAnimated(fireTextures, new Vector2(5, 0), 3f, 6f));

            backgrounds.Add(new Background(game.Content.Load<Texture2D>(@"Background\Dark\layer_03_1920 x 1080"), new Vector2(100, 0), 0.9f));
            backgrounds.Add(new Background(game.Content.Load<Texture2D>(@"Background\Dark\layer_02_1920 x 1080"), new Vector2(300, 0), 1f));
            backgrounds.Add(new Background(game.Content.Load<Texture2D>(@"Background\Dark\layer_01_1920 x 1080"), new Vector2(300, 0), 0.7f));

            // hack to position the background propery
            backgrounds[backgrounds.Count - 2].Offset.Y = 120;
            backgrounds[backgrounds.Count - 1].Offset.Y = 100;
        }
示例#16
0
    private void Shoot()
    {
        Bullet bullet = new Bullet(new Vector2(x, y - height / 2), new Vector2(0, -1), "Player", "bullet.png");

        //play shoot sfx
        MyGame.PlaySFX("Sounds/playerShoot.wav", 0.3f);
    }
示例#17
0
    public Wall(Level pLevel) : base("white.png")
    {
        _scrollSpeed = MyGame.GetScrollSpeed();
        _tileSize    = MyGame.GetTileSize();
        _level       = pLevel;
        _length      = Utils.Random(3, 6);

        //false (x = 0), true (x = game.width)
        //_positionX = OurUtils.RandomBool() ? game.width : 0;
        bool test = OurUtils.RandomBool();

        if (test)
        {
            SetOrigin(width, 0);
            _positionX = game.width;
        }
        else
        {
            SetOrigin(0, 0);
            _positionX = 0;
        }
        _positionY = Utils.Random(0, game.height) - game.height;

        x = _positionX;
        y = _positionY;
        //Console.WriteLine(x + " " + y);
        //Console.WriteLine(_positionX + " " + _positionY);
        CreateWall(_length, _positionX, _positionY);
    }
示例#18
0
    public LoseScreen(MyGame pMyGame, Player pPlayer) : base("assets\\menu\\spaceBG.png")
    {
        _myGame = pMyGame;
        _player = pPlayer;

        _sprite   = new Sprite("assets\\menu\\deathscreen.png");
        _sprite.x = 0;
        _sprite.y = 0;

        AddChild(_sprite);

        _canvas = new Canvas(game.width, game.height);
        AddChild(_canvas);

        endTimer = _myGame.GetPlayer().finishTimer;
        _myGame.GetPlayer().finishTimer = 0;

        finalScore = (_player.score == 0) ? 0 : _player.Score * 100 - endTimer;

        _pfc = new PrivateFontCollection();
        _pfc.AddFontFile("assets\\font\\zig_____.ttf");
        _font = new Font(_pfc.Families[0], 24);

        _canvas.graphics.DrawString("Final score: " + Mathf.Abs(finalScore), _font, Brushes.White, game.width / 2 - 300, 600);

        //_canvas.graphics.DrawString("Final score: " + finalScore, _font, Brushes.White, 0, 0);
    }
示例#19
0
 public Animation(MyGame theGame, int startFrame, int endFrame, float intervalInSeconds)
 {
     m_timer = new PTimer(theGame.TimerManager, null);
     m_startFrame = startFrame;
     m_endFrame = endFrame;
     m_timer.Interval = intervalInSeconds;
 }
示例#20
0
文件: HUD.cs 项目: suppd/Game
 public HUD_Score(MyGame myGame) : base(400, 400, false)
 {
     SetOrigin(width / 2, height / 2);
     _myGame = myGame;
     x       = 1000;
     y       = 500;
 }
示例#21
0
    public PhysicsEntity(float restitutionToSet, float Mass, Vector x, Vector v, Vector a, string filename, Layer layer) : base()
    {
        Layer = layer;
        //game.AddChildAt(this,childLayer);
        //SetOrigin(width / 2, height / 2);
        restitution = restitutionToSet;

        if (Utils.IsNearEqual(Mass, 0f, 0.01f))
        {
            invMass    = 0;
            invInertia = 0;
        }
        else
        {
            invMass = 1 / Mass;
        }
        position     = x;
        velocity     = v;
        acceleration = a;
        UpdatePosition(position);

        MyGame.AddEntity(this);
        COM = position;

        IDP = ID;
        ID++;
    }
示例#22
0
        public GameEngine(MyGame game)
        {
            screenLog = new ScreenLog();
            _hotkeys = new List<HotKey>();
            _hotkeys.Add(new HotKey(new Keys[] { Keys.O }, SwichDebugRender));
            _hotkeys.Add(new HotKey(new Keys[] { Keys.P }, SwichBehaviourModel));

            KeyboardManager.Manager.AddKeyboardUser(this);

            game._engine = this;
            packs = new PackList();
             //   newPacks = new ContentNew.PackList();
            Instance = this;
            lightDir.Normalize();

            gameScene = new EngineScene();
            Scene = gameScene.Scene;

            //разме рэкрана
            MyGame.DeviceManager.PreferredBackBufferWidth = (int)(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width *0.8 );
            MyGame.DeviceManager.PreferredBackBufferHeight = (int) (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height*0.8);
            GameConfiguration.ScreenResolution = new Vector2(MyGame.DeviceManager.PreferredBackBufferWidth, MyGame.DeviceManager.PreferredBackBufferHeight);

            MyGame.DeviceManager.IsFullScreen = false;

            _cashe = new ObjectCashe();
        }
示例#23
0
    //initialize game here
    public Level(MyGame pMyGame)
    {
        _myGame = pMyGame;
        rnd     = new Random();

        player1 = new Player("assets\\player_sprite\\player_sheet.png", Key.A, Key.D, Key.W, Key.S, Key.V, Key.B, 20, 7);
        AddChildAt(player1, 3);
        player1.SetXY(100, 600);

        background   = new Background();
        foreground   = new Foreground();
        foreground.y = -1;

        AddChildAt(background, 2);

        bgMusicSound       = new Sound("assets\\sfx\\level.wav", true, true);
        levelCompleteMusic = new Sound("assets\\sfx\\level_complete.wav", false, false);
        playMusic          = bgMusicSound.Play();

        _em = new EnemyManager(player1);
        _em.createEnemies();

        _em.GetDeadEnemyList().CollectionChanged += Level_CollectionChanged;

        fighterListOrder.Add(player1);
        foreach (Fighter fighter in _em.GetAllEnemies())
        {
            fighterListOrder.Add(fighter);
        }

        hud   = new HUD(this, GetPlayer());
        hud.y = game.height - hud.height;
        game.AddChildAt(hud, 1);
    }
示例#24
0
        public GameScene(MyGame g)
            : base(g)
        {
            this.Components = new List<GameComponent>();

            this.End();
        }
示例#25
0
 public Road(string filename, Level pLevel) : base(filename)
 {
     _level       = pLevel;
     _scrollSpeed = MyGame.GetScrollSpeed();
     _tileSize    = MyGame.GetTileSize();
     Rescale();
 }
示例#26
0
 public MyGame() : base(800, 600, false)     // Create a window that's 800x600 and NOT fullscreen
 {
     Instance     = this;
     levelManager = new LevelManager();
     AddChild(levelManager);
     LoadSounds();
 }
示例#27
0
    public Level() : base()
    {
        //initialise variables
        _scrollSpeed = MyGame.GetScrollSpeed();
        _tileSize    = MyGame.GetTileSize();

        //Timer initialization
        _lastUpdatedVictimTime = 0;
        _lastUpdatedEnemyTime  = 0;

        //Depth
        _floorLayer  = new LevelLayer();
        _victimLayer = new LevelLayer();
        _poopLayer   = new LevelLayer();
        _flightLayer = new LevelLayer();
        _hudLayer    = new LevelLayer();
        AddChild(_floorLayer);
        AddChild(_victimLayer);
        AddChild(_poopLayer);
        AddChild(_flightLayer);
        AddChild(_hudLayer);

        CreatePlayer();
        CreateRoad();
        //CreateEnemy();
        CreateHUD();
    }
示例#28
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (MyGame game = new MyGame())
     {
         game.Run();
     }
 }
示例#29
0
 static void Main()
 {
     using (var myGame = new MyGame())
     {
         myGame.Run();
     }
 }
示例#30
0
        static public void LoadPlayerCards(Player p, byte fromcard = 0)
        {
            ClearImages();
            if (fromcard == 0)
            {
                firstcardindex = 0;
            }
            if (p.Cards.Count > MyGame.playerboxes.Length)
            {
                MyGame.TurnOnOrOffButtons(true);
            }
            else
            {
                MyGame.TurnOnOrOffButtons(false);
            }

            foreach (var b in MyGame.playerboxes)
            {
                b.Visible = true;
            }
            int i = fromcard;

            for (int j = 0; j < MyGame.playerboxes.Length && j < p.Cards.Count - fromcard; j++, i++)
            {
                LoadImageFromCard(p.Cards[i], MyGame.playerboxes[j]);
            }
            if (i < MyGame.playerboxes.Length)
            {
                MyGame.playerboxes[i].Visible = false;
            }
        }
示例#31
0
    public MyGame(string[] tmxFileNames, int levelIndex) :
        base(SCREEN_WIDTH, SCREEN_HEIGHT, FULLSCREEN) // Create a window that's 800x600 and NOT fullscreen
    {
        GL.ClearColor(1f, 1f, 1f, 1f);

        ThisInstance = this;

        _levelFiles = tmxFileNames;

        if (_levelFiles.Length == 0)
        {
            throw new ApplicationException(
                      $"_levelFiles.Length == 0, no tmx files found in {AppDomain.CurrentDomain.DynamicDirectory}");
        }

        LoadScoreBoardData();

        _mapData = TiledMapParserExtended.MapParser.ReadMap(_levelFiles[levelIndex]);

        _map = new MapGameObject(_mapData);

        _camera = new FollowCamera(0, 0, width, height);

        _canvasDebugger = new CanvasDebugger2(width, height);

        AddChild(SoundManager.Instance);

        var hudScreenFader = new HudScreenFader();

        StartScreen();

        //var startScreen = new StartScreen();
        //AddChild(startScreen);
    }
示例#32
0
 void checkForButtonClicks()
 {
     if ((!isInScene && !journal.GetInWindow()))
     {
         for (int i = 0; i < buttons.Count; i++)
         {
             if (MyGame.CheckMouseInRectClick(buttons[i]) && !MyGame.CheckMouseInRect(journal.GetJournalButton()))
             {
                 if (i < 3)
                 {
                     scenes[i].visible  = true;
                     scenes[i].isActive = true;
                     isInScene          = true;
                     if (_options.isSoundPlaying)
                     {
                         clicks.Play();
                     }
                     if (tutorial.GetCount() == 1 && i == 0)
                     {
                         tutorial.SetCount(2);
                     }
                 }
             }
         }
         home.alpha = 1f;
     }
 }
示例#33
0
 /// <summary>
 ///     Main entry-point for this application.
 /// </summary>
 private static void Main()
 {
     using (MyGame game = new MyGame())
     {
         game.Run();
     }
 }
示例#34
0
    public Level(MyGame myGame, Options options) : base()
    {
        clicks   = new Sound("clicking button sound.wav");
        tutorial = new Tutorial(new Vec2(game.width / 2 - 150, game.height - 400), this);
        font     = new Font("Fast Action", 24);

        initSprites();


        _options    = options;
        this.myGame = myGame;


        isInScene = false;
        canvas    = new Canvas(200, 100);
        canvas.SetXY(game.width - 140, 50);
        initLists();
        journal = new Journal(this);
        initBools();
        currencySystem = new CurrencySystem();
        initButtons();
        AddChild(hub);
        initScenes();
        AddChild(canvas);
        AddChild(moneyIcon);
        AddChild(journal);
        AddChild(home);
        AddChildAt(tutorial, 100);
        SetChildIndex(journal, 100);
    }
示例#35
0
    void Update()
    {
        canvas.graphics.Clear(Color.Transparent);
        canvas.graphics.DrawString(currencySystem.getMoney().ToString(), font, Brushes.Yellow, 0, 0);

        checkForButtonClicks();

        if (isInScene)
        {
            home.alpha = 0f;
        }
        if (HasChild(tutorial))
        {
            inTutorial = true;
        }
        if (!HasChild(tutorial))
        {
            inTutorial = false;
        }
        if (MyGame.CheckMouseInRectClick(home) && home.alpha == 1f)
        {
            parent.RemoveChild(this);
            myGame.SetIsPlaying(false);
        }
    }
示例#36
0
        protected void SetUp()
        {
            IGameManager manager = new GameManager
                                   (
                AnimationManager,
                CollisionManager,
                ConfigManager,
                ContentManager,
                EnemysManager,
                InputManager,
                LevelManager,
                PlayerManager,
                PhysicsManager,
                RandomManager,
                ResolutionManager,
                ScreenManager,
                SoundManager,
                ScrollManager,
                StateManager,
                TileManager,
                FileManager,
                Logger
                                   );

            MyGame.Construct(manager);
        }
示例#37
0
        public MainPage()
        {
            InitializeComponent();

              // Create the MyGame instance, which implements the "game loop" and takes care of 3D rendering.
              _game = new MyGame();
        }
示例#38
0
    private void Rescale()
    {
        float xScale = MyGame.OldX() / width;
        float yScale = MyGame.OldY() / height;

        SetScaleXY(xScale, yScale);
    }
示例#39
0
 public void DeleteRoomDone()
 {
     if (!ActiveRoom.Active)
     {
         MyGame.Disconnect();
     }
 }
示例#40
0
 public GhostAIController(MyGame g, Ghost player, IControllable target)
     : base(g)
 {
     this.Target = target;
     this.Ghost = player;
     this.Ghost.ReadyToMove += Ghost_ReadyToMove;
     this.Ghost.Behavior.StateChanged += GhostBehavior_StateChanged;
 }
示例#41
0
文件: Menu.cs 项目: mbos14/GTFO
        public Menu(MyGame pGame)
        {
            AddChild(_highscore);
            _game = pGame;
            drawBackGround();

            _highscore.DrawHighScore(15, this);
        }
示例#42
0
        public Text(MyGame g, SpriteFont font, String msg)
            : base(g)
        {
            this.Message = msg;
            this.Color = Color.White;

            this.font = font;
        }
示例#43
0
        public BaseSprite(float x, float y, int width, int height, string textureName, TypeSprite type, MyGame game)
        {
            this._textureName = textureName;

            this._box = new Rectangle((int)x, (int)y, width, height);

            this._typeSprite = type;
            this._game = game;
        }
示例#44
0
        public Drawer(MyGame myGame)
        {
            _myGame = myGame;
            _context = myGame.GraphicsDevice;
            _vertexSizeInBytes = Marshal.SizeOf(typeof(Vertex2DPositionColor));

            InitializeEffect();
            InitializeConstantBuffer();
        }
示例#45
0
 public PlayerShip(Vector2 position, MyGame.IO.InputManager inputManager)
     : base(position, new Collidable(Textures.Ship, position, Color.White, 0, new Vector2(100, 50), .9f), 500)
 {
     
     inputManager.Register(forward, this);
     inputManager.Register(back, this);
     inputManager.Register(left, this);
     inputManager.Register(right, this);
 }
示例#46
0
 public PerspectiveCamera(MyGame myGame)
     : base(myGame)
 {
     Position = new Vector3(0, 5, 80); 
     LookAt = new Vector3(0,0,-1);
     MoveSpeed = 20;
     ZNear = 0.01f;
     ZFar = 100000000000f;
     UpdateMatrices();
 }
示例#47
0
        public void LoadContent(MyGame game)
        {
            PowerTextures = LoadPowerTextures(game);
            PowerLocations = LoadPowerLocations();
            spriteBatch = new SpriteBatch(game.GraphicsDevice);

            player.LoadContent(game);
            map.LoadContent(game);
            background.LoadContent(game);
        }
示例#48
0
文件: Level.cs 项目: mbos14/GTFO
        public Level(MyGame pGame, string pFileName)
        {
            _fileName = pFileName;
            thisgame = pGame;

            addPivots();
            drawAll();

            Camera cam1 = new Camera(player, this);
            AddChild(cam1);
        }
示例#49
0
        public MainWindow()
        {
            InitializeComponent();

              // Create the MyGame instance, which implements the "game loop" and takes care
              // of 3D rendering.
              _game = new MyGame();

              // Load the "game level" consisting of some 3D models, lights, etc.
              TestLevel.Create();
        }
示例#50
0
 public GameEngine(MyGame game)
 {
     lightDir.Normalize();
     DeviceManager = new GraphicsDeviceManager( game );
     //разме рэкрана1158; 708
     DeviceManager.PreferredBackBufferWidth = 1158;
     DeviceManager.PreferredBackBufferHeight = 708;
     objectstoadd = new MyContainer<PivotObject>();
     gameLevel = new EngineLevel();
     databaseManager = ResourceCollector.Logic.DatabaseManager.Manager;
 }
示例#51
0
        public void Draw(MyGame game, GameTime gameTime)
        {
            var spriteBatch = game.spriteBatch;

            spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null);

            foreach (Background bg in backgrounds)
            {
                bg.Draw(spriteBatch);
            }

            spriteBatch.End();
        }
示例#52
0
 public static Texture2D [,] LoadPowerTextures (MyGame game)
 {
     int amountOfPowersRows = 4, amountOfPowerCollumns = 2;
     Texture2D[,] returnTextures = new Texture2D[amountOfPowersRows, amountOfPowerCollumns];
     List<string> NamesNonClicked = new List<string> { "Powers/FireButton", "Powers/WaterButton", "Powers/EarthButton", "Powers/AirButton" };
     List<string> NamesClicked = new List<string> { "Powers/FireButtonClicked", "Powers/WaterButtonClicked", "Powers/EarthButtonClicked", "Powers/AirButtonClicked" };
     for (int i = 0; i < NamesNonClicked.Count; i++)
     {
         returnTextures[i, 0] = game.Content.Load<Texture2D>(NamesNonClicked[i]);
         returnTextures[i, 1] = game.Content.Load<Texture2D>(NamesClicked[i]);
     }
     return returnTextures;
 }
示例#53
0
        public TheGame(MyGame __game)
        {
            _engine = new GameEngine(__game);
            _staticData = StaticObjects.Instance();
            _level = new GameLevel(_engine.gameScene);

            _characters = new Dictionary<string, CharacterLogicController>();
               // _weapons = new Dictionary<string, WeaponLogicController>();

            _hotkeys = new List<HotKey>();
            _hotkeys.Add(new HotKey(new Keys[] { Keys.I }, SwichGunState));

            KeyboardManager.Manager.AddKeyboardUser(this);
        }
示例#54
0
文件: GameTests.cs 项目: Conn/Balder
 public void SpecifyingGameClassShouldRegisterGame()
 {
     var game = new MyGame();
     var runtimeMock = new Mock<IRuntime>();
     var displayMock = new Mock<IDisplay>();
     var displayDeviceMock = new Mock<IDisplayDevice>();
     displayDeviceMock.Expect(d => d.CreateDisplay()).Returns(displayMock.Object);
     var platformMock = new Mock<IPlatform>();
     platformMock.Expect(p => p.DisplayDevice).Returns(displayDeviceMock.Object);
     runtimeMock.Expect(r => r.RegisterGame(It.IsAny<IDisplay>(),game));
     var gameControl = new Game {GameClass = game, Runtime = runtimeMock.Object, Platform = platformMock.Object, Width=640, Height=480};
     SilverUnit.FireEvent(gameControl, "Loaded", null, null);
     runtimeMock.VerifyAll();
 }
示例#55
0
        public virtual void LoadContent(MyGame game)
        {
            backgrounds = new List<Background>();
            backgrounds.Add(new Background(game.Content.Load<Texture2D>(@"Background\Dark\layer_07_1920 x 1080"), new Vector2(0, 0), 0.7f));
            backgrounds.Add(new Background(game.Content.Load<Texture2D>(@"Background\Dark\layer_06_1920 x 1080"), new Vector2(10, 0), 0.9f));
            backgrounds.Add(new Background(game.Content.Load<Texture2D>(@"Background\Dark\layer_05_1920 x 1080"), new Vector2(20, 0), 0.9f));
            backgrounds.Add(new Background(game.Content.Load<Texture2D>(@"Background\Dark\layer_04_1920 x 1080"), new Vector2(50, 0), 0.9f));
            backgrounds.Add(new Background(game.Content.Load<Texture2D>(@"Background\Dark\layer_03_1920 x 1080"), new Vector2(100, 0), 0.9f));
            backgrounds.Add(new Background(game.Content.Load<Texture2D>(@"Background\Dark\layer_02_1920 x 1080"), new Vector2(300, 0), 1f));
            backgrounds.Add(new Background(game.Content.Load<Texture2D>(@"Background\Dark\layer_01_1920 x 1080"), new Vector2(300, 0), 0.7f));

            // hack to position the background propery
            backgrounds[backgrounds.Count - 2].Offset.Y = 120;
            backgrounds[backgrounds.Count - 1].Offset.Y = 100;
        }
示例#56
0
        public static PlayerShip Factory(Vector2 position, MyGame.IO.InputManager inputManager)
        {

            //GunnerController gunner0 = GunnerController.CreateGunner(0);
            //GunnerController gunner1 = GunnerController.CreateGunner(1);
            PlayerShip ship = new PlayerShip(position, inputManager);
            GameObject.Collection.Add(ship);

            /*PlayerRotatingGun gun1 = new PlayerRotatingGun(this, new Vector2(0, 25), (float)(Math.PI / 2), gunner0);
            GameObject.Collection.Add(gun1);
            PlayerRotatingGun gun2 = new PlayerRotatingGun(this, new Vector2(0, -25), (float)(-Math.PI / 2), gunner1);
            GameObject.Collection.Add(gun2);
            this.GameState.AddLocalUpdateable(gunner0);
            this.GameState.AddLocalUpdateable(gunner1);*/
            return ship;
        }
示例#57
0
        public void LoadContent(MyGame game)
        {
            selectedButton[0] = true;
            spriteBatch = new SpriteBatch(game.GraphicsDevice);
            fireButton = game.Content.Load<Texture2D>("FireButton");
            earthButton = game.Content.Load<Texture2D>("EarthButton");
            airButton = game.Content.Load<Texture2D>("AirButton");
            waterButton = game.Content.Load<Texture2D>("WaterButton");
            fireButtonSelected = game.Content.Load<Texture2D>("FireButtonSelected");
            earthButtonSelected = game.Content.Load<Texture2D>("EarthButtonSelected");
            airButtonSelected = game.Content.Load<Texture2D>("AirButtonSelected");
            waterButtonSelected = game.Content.Load<Texture2D>("WaterButtonSelected");
            ritual = game.Content.Load<Texture2D>("ritual");
            pentagram = game.Content.Load<Texture2D>("pentagram");

            background.LoadContent(game);
        }
示例#58
0
        public PlayerShip(Vector2 position, MyGame.IO.InputManager inputManager)
            : base(position, new Collidable(Textures.Ship, position, Color.White, 0, new Vector2(100, 50), .9f), 400)
        {
            inputManager.Register(forward, this);
            inputManager.Register(back, this);
            inputManager.Register(left, this);
            inputManager.Register(right, this);

            new PlayerGun(this, new Vector2(100, 0), 0, inputManager);
            new PlayerRotatingGun(this, new Vector2(-69, 25), (float)(Math.PI / 2), inputManager);
            new PlayerRotatingGun(this, new Vector2(-69, -25), (float)(-Math.PI / 2), inputManager);

            new PlayerRotatingGun(this, new Vector2(0, 25), (float)(Math.PI / 2), inputManager);
            new PlayerRotatingGun(this, new Vector2(0, -25), (float)(-Math.PI / 2), inputManager);

            new PlayerRotatingGun(this, new Vector2(40, 25), (float)(Math.PI / 2), inputManager);
            new PlayerRotatingGun(this, new Vector2(40, -25), (float)(-Math.PI / 2), inputManager);
        }
示例#59
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     try
     {
         foreach (string arg in args)
         {
             if (arg == "-git")
             {
                 string git_commander = @"C:\Users\shpengler\Desktop\git\GitCommander\GitCommander\bin\Debug\GitCommander.exe";
                 Process.Start(git_commander, @"-w C:\Users\shpengler\Desktop\git\Game");
             }
         }
     }
     catch { }
     Config.Init();
     game = new MyGame();
     game.Run();
 }
示例#60
0
        public void Update(MyGame game, GameTime gameTime, PlayerAction action)
        {
            //Get directional vector based on input
            float direction = 0f;

            if ((action & PlayerAction.MoveLeft) == PlayerAction.MoveLeft)
            {
                direction += -1f;
            }
            else if ((action & PlayerAction.MoveRight) == PlayerAction.MoveRight)
            {
                direction += 1f;
            }

            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
            float distance = direction * SPEED * elapsed;
            offset += distance;
        }