Inheritance: GameEnvironment
Example #1
1
 /// <summary>
 /// Constructeur
 /// </summary>
 /// <param name="port">Port d'ecoute</param>
 /// <param name="cl"></param>
 public Recepteur(int port, Game1 cl)
 {
     this._client = cl;
     this._portReception = port;
     this._ip = GestionReseau.GetMyLocalIp();
     _reception = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
 }
Example #2
1
        public Button(Texture2D texture, Vector2 position, string text, SpriteFont font, Game1 game)
            : base(position)
        {
            base.Text = text;
            this.texture = texture;
            this.Font = font;
            bounds = new Rectangle((int)position.X, (int)position.Y, texture.Width, texture.Height);

            switch (Text) {
                case "Create":
                    change = MenuState.Create;
                    break;
                case "Join":
                    change = MenuState.Join;
                    break;
                case "Exit to menu":
                case "Back":
                    change = MenuState.Menu;
                    break;
                default:
                    change = null;
                    break;
            }

            if (Text.Contains("Level")) change = MenuState.Start;
            WireUpEvents(game);
        }
Example #3
0
 /// <summary>
 /// Конструктор класса
 /// </summary>
 /// <param name="Rect">прямоугольник объекта</param>
 /// <param name="texture">текстура объекта</param>
 /// <param name="game">ссылка на игру</param>
 /// <param name="camera">ссылка на камеру</param>
 public BaseObject(Rectangle Rect, Texture2D texture, Game1 game, Camera camera)
 {
     this.Rect = Rect;
     this.texture = texture;
     this.game = game;
     this.camera = camera;
 }
Example #4
0
        public void Draw(SpriteBatch sb, Game1 game)
        {
            float Lenght = (float)Math.Sqrt((p1.X - p2.X) * (p1.X - p2.X) + (p1.Y - p2.Y) * (p1.Y - p2.Y));
            float Angle = (float)Math.Atan2(p1.Y - p2.Y, p1.X - p2.X) - (float)Math.PI;
            Rectangle sourceRectangle = new Rectangle(0, 0, 1, 1);
            Vector2 origin = new Vector2(0f, 0.5f);

            Color color = Color;
            //if (color == game.ColorToChange)
            //    color = game.NewColor;
            if (Owner != null && (game.WinningTeam == Owner.Team && game.ShouldFlash && !Owner.Dead))
                color = new Color(Color.R / 2, Color.G / 2, Color.B / 2);

            if (Owner == null || Owner.Dead)
            {
                color.R >>= 2;
                color.G >>= 2;
                color.B >>= 2;
                color.A >>= 2;
            }

            if (game.Paused)
            {
                color.R >>= 2;
                color.G >>= 2;
                color.B >>= 2;
                color.A >>= 2;
            }

            sb.Draw(Texture, new Rectangle((int)p1.X, (int)p1.Y, (int)Lenght, 2), null, color, Angle, origin, SpriteEffects.None, 1);
        }
 public AABBCollisionRenderSystem(Game1 game)
     : base(game)
 {
     this._componentDependencies.Add(ComponentType.Position);
     this._componentDependencies.Add(ComponentType.AABBCollision);
     this._componentDependencies.Add(ComponentType.Color);
 }
Example #6
0
        public FirstBossSprite(Game1 game, Texture2D textureImage, Vector2 position,
            Point frameSize, int collisionOffset, Point currentFrame, Point sheetSize,
            Vector2 speed, bool animate, int life, int millisecondsPerFrame)
            : base(game, textureImage, position, frameSize, collisionOffset, currentFrame,
            sheetSize, speed, animate, life * (int)InGameScreen.difficulty, millisecondsPerFrame)
        {
            alive = true;

            scoreAmount = 60;

            warningTexture = new Texture2D(game.GraphicsDevice, 1, 1);
            warningTexture.SetData<Color>(colorData);

            laserStruckTarget = false;

            //Creates the left hitbox.
            hitBox.X = 37 + (int)position.X;
            hitBox.Y = 156 + (int)position.Y;
            hitBox.Width = 30;
            hitBox.Height = 47;

            //Creates the right hitbox.
            nonMoveableBossHitbox.X = 121 + (int)position.X;
            nonMoveableBossHitbox.Y = 147 + (int)position.Y;
            nonMoveableBossHitbox.Width = 30;
            nonMoveableBossHitbox.Height = 47;
        }
 public SplashScreen(Game game)
     : base(game)
 {
     this.game = game;
     game1 = (Game1)game;
     // TODO: Construct any child components here
 }
 public PauseMenu(IGameState prevGameState, Game1 game)
 {
     this.game = game;
     this.prevGameState = prevGameState;
     currentSelection = Selections.Resume;
     font = MenuSpriteFactory.CreateHUDFont();
 }
Example #9
0
 public BeamBit(Game1 game, BeamPool pool)
     : base(game)
 {
     Pool = pool;
     AssetName = "shipBullet";
     AddAnimation("shot", FrameSequence(0, 1), TimingSequence(5, 1), true);
 }
Example #10
0
        public BaseGameState(Game game, GameStateManager manager)
            : base(game, manager)
        {
            GameRef = (Game1)game;

            playerIndexInControl = PlayerIndex.One;
        }
        public BootstrapLoad(Game1 game, IScreen nextScreen, IScreen errorScreen, Action<Action, Action<String>> load)
        {
            Next = nextScreen;
            this.game = game;

            loadingThread = new Thread(a => load(() => complete = true, s => strings.Push(s)));
        }
Example #12
0
 public ColonyShip(Game1 game, World world, float ratio, string texturePath, Player player)
     : base(game, world, texturePath)
 {
     _texture = Content.Load<Texture2D>(texturePath);
     _ratio = ratio;
     this.player = player;
 }
Example #13
0
 protected ParticleSystem(Game1 game, int howManyEffects, string textureFileName)
     : base(game)
 {
     this.game = game;
     this.howManyEffects = howManyEffects;
     this.textureFilename = textureFileName;
 }
Example #14
0
 public HandRenderer1(Game1 game)
     : base(game)
 {
     this._componentDependencies.Add(ComponentType.Hand);
     this._componentDependencies.Add(ComponentType.Player);
     this._game = game;
 }
 public DoublePipe(IGameState gameState, Game1 game)
 {
     myGame = game;
     pipeSprite = TileSpriteFactory.CreateDoublePipeSprite();
     isWarpPipe = true;
     this.gameState = gameState;
 }
 public DoublePipe(Vector2 marioWarpCoordinates, Game1 game)
 {
     myGame = game;
     pipeSprite = TileSpriteFactory.CreateDoublePipeSprite();
     isWarpPipe = true;
     warpLocation = marioWarpCoordinates;
 }
Example #17
0
 public Card(Game1 game, int x, int y)
 {
     this.game = game;
     this.x = x;
     this.y = y;
     LoadImage();
 }
 public GameState(Game1 game, GameStateManager manager)
     : base(game)
 {
     StateManager = manager;
     childComponents = new List<GameComponent>();
     tag = this;
 }
Example #19
0
 public ArrowInputSystem(Game1 game, int playerNum)
     : base(game)
 {
     this._componentDependencies.Add(ComponentType.Player);
     this._componentDependencies.Add(ComponentType.Arrow);
     this.playerNumber = playerNum;
 }
Example #20
0
        public LevelThree(Game1 game)
            : base(game)
        {
            _questions["*"].Add("3,2");
            _questions["*"].Add("4,5");
            _questions["*"].Add("2,4");
            _questions["*"].Add("1,2");
            _questions["*"].Add("3,1");
            _questions["*"].Add("6,2");
            _questions["*"].Add("4,1");
            _questions["*"].Add("1,1");
            _questions["*"].Add("2,5");
            _questions["*"].Add("4,3");
            _questions["*"].Add("3,3");
            _questions["*"].Add("4,4");

            _questions["/"].Add("16,4");
            _questions["/"].Add("20,5");
            _questions["/"].Add("10,2");
            _questions["/"].Add("15,3");
            _questions["/"].Add("8,4");
            _questions["/"].Add("4,4");
            _questions["/"].Add("12,2");
            _questions["/"].Add("2,1");
            _questions["/"].Add("18,9");
            _questions["/"].Add("9,3");
            _questions["/"].Add("24,3");
            _questions["/"].Add("28,4");
            _mountain.Texture = AssetManager.Textures[Assets.GAME_MOUNTAIN_3];
            _mountain.Location.Y += 75;
            GenerateQuestion();
        }
 public MovingGameObject(Game1 game)
     : base(game)
 {
     velocity = new InterpolatedVector2GameObjectMember(this, new Vector2(0));
     angularSpeed = new FloatGameObjectMember(this, 0);
     targetAngle = new FloatGameObjectMember(this, 0);
 }
Example #22
0
 public StaticObjectManager(Game1 game)
     : base(game)
 {
     objects = new List<GameObject>();
     spriteBatch = new SpriteBatch(Game.GraphicsDevice);
     contentManager = game.ContentManager;
 }
Example #23
0
        public GameLobby(Game1 g, MenuManager mm)
            : base(g, mm)
        {
            // pos is proportional to screen size (IE, SCREENWIDTH / 20 * pos)
            AddFlavorItem("Class Type", new Vector2(1, 11));
            AddFlavorItem("_________", new Vector2(1, 12));
            AddMenuItem("Mapmaker", new Vector2(1, 13), 0,
                delegate() { classType = "mapmaker"; SendClass(); ActivateItem(0, 0); });
            AddMenuItem("Ninja", new Vector2(1, 14), 0,
                delegate() { classType = "ninja"; SendClass(); ActivateItem(1, 0); });
            AddMenuItem("Powdermonkey", new Vector2(1, 15), 0,
                delegate() { classType = "powdermonkey"; SendClass(); ActivateItem(2, 0); });
            AddMenuItem("Capitalist", new Vector2(1, 16), 0,
                delegate() { classType = "capitalist"; SendClass(); ActivateItem(3, 0); });
            AddMenuItem("Apothecary", new Vector2(1, 17), 0,
                delegate() { classType = "apothecary"; SendClass(); ActivateItem(4, 0); });
            AddMenuItem("Mystic", new Vector2(1, 18), 0,
               delegate() { classType = "mystic"; SendClass(); ActivateItem(5, 0); });

            AddFlavorItem("Team", new Vector2(7, 11));
            AddFlavorItem("_________", new Vector2(7, 12));
            AddMenuItem("Blue", new Vector2(7, 13), 1,
                delegate() { team = 0; SendTeam(); ActivateItem(0, 1); });
            AddMenuItem("Red", new Vector2(7, 14), 1,
                delegate() { team = 1; SendTeam(); ActivateItem(1, 1); });

            AddMenuItem("OK", new Vector2(15, 12), 2,
               delegate() { SendReady();  });

            AddFlavorItem("____________________________________________________________________", new Vector2(0, 9.5f));
        }
Example #24
0
 public GameObject(Game1 game, Vector2 startLocation)
 {
     this.Game = game;
     this.Location = startLocation;
     this.Transparency = 1;
     SpriteEffect = SpriteEffects.None;
 }
Example #25
0
 public Player(Game game, Character character)
 {
     gameRef = (Game1)game;
     camera = new Camera(gameRef.ScreenRectangle);
     this.character = character;
     Sprite.Position = new Vector2(1000, 1000);
 }
Example #26
0
 // ReSharper restore UnusedParameter.Local
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 // ReSharper disable UnusedParameter.Local
 private static void Main(string[] args)
 {
     using (var game = new Game1())
     {
         game.Run();
     }
 }
 public PlayerInputSystem(Game1 game, int playerNumber)
     : base(game)
 {
     this._componentDependencies.Add(ComponentType.Transform2D);
     this._componentDependencies.Add(ComponentType.Player);
     this.PlayerNumber = playerNumber;
 }
Example #28
0
 public ModeInputSystem(Game1 game)
     : base(game)
 {
     this.wasPressed = false;
     this.filled = false;
     this._game = game;
 }
Example #29
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Example #30
0
        public void Initialize(Vector2 screenDimension, SpriteFont font, Game1 game)
        {
            this.screenDimension = screenDimension;
            spFont = font;

            this.game = game;
        }