예제 #1
0
 public TemporaryEffect(GameCore game, Vector2 position, MyTexture2D tex, double lifeTime)
     : base(game)
 {
     this._position = position;
     this._lifeTime = lifeTime;
     this._tex = tex;
     _game = game;
     _game.Components.Add (this);
     DrawOrder = 1000;
 }
예제 #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            OneWhitePixel = Content.Load<Texture2D>("onewhitepixel");
            Cling = Content.Load<Texture2D>("clig");
            _backGnd = Content.Load<Texture2D>("Interface/fond");
            //font = Content.Load<SpriteFont>("font");

            leak = new MyTexture2D(Content.Load<Texture2D>("jet_eau"), 4, new double[]{1000.0/12, 1000.0/12, 1000.0/12, 1000.0/12});
            kohl = Content.Load<Texture2D>("charbon");
            warning = new MyTexture2D(Content.Load<Texture2D>("warning"), 2, new double[]{150, 150});
            action = Content.Load<Texture2D>("action");
            credits = Content.Load<Texture2D>("credits");

            txtCharb = Content.Load<Texture2D>("Text/texte_charbon");
            txtCook = Content.Load<Texture2D>("Text/texte_cuisine");
            txtDodo = Content.Load<Texture2D>("Text/texte_dortoir");
            txtFuite = Content.Load<Texture2D>("Text/texte_fuite");
            txtPilot = Content.Load<Texture2D>("Text/texte_pilotage");
            txtSdm = Content.Load<Texture2D>("Text/texte_sdm");

            //must be after txt textures init
            Events.Add (new MustDriveShip (this));
            Events.Add (new AllToCale (this));
            Events.Add (new GetFood (this));
            Events.Add (new FixEngine (this));
            Events.Add (new GetTrap (this));
            Events.Add (new CarryKohl (this));
            Events.Add (new GetTrap (this));
            Events.Add (new AllToCale (this));
            Events.Add (new GetTrap (this));
            Events.Add (new FixEngine (this));
            Events.Add (new GetFood (this));
            Events.Add (new FixEngine (this));
            Events.Add (new AllToCale (this));

            _eventTriggers = new []{
                TimeSpan.FromSeconds(120 - 8),  //goto cale
                TimeSpan.FromSeconds(120 - 15), //+life
                TimeSpan.FromSeconds(120 - 25), //fix engine
                TimeSpan.FromSeconds(120 - 33), //+trap
                TimeSpan.FromSeconds(120 - 40), //coal
                TimeSpan.FromSeconds(120 - 47), //+trap
                TimeSpan.FromSeconds(120 - 60),  //goto cale
                TimeSpan.FromSeconds(120 - 70), //+trap
                TimeSpan.FromSeconds(120 - 80), //fix engine
                TimeSpan.FromSeconds(120 - 90), //+life
                TimeSpan.FromSeconds(120 - 94), //fix engine
                TimeSpan.FromSeconds(120 - 110), //goto cale
            };

            chrono = new MyTexture2D(Content.Load<Texture2D>("Interface/chrnometre_anime"), 21, new double[]{1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000});
            support = Content.Load<Texture2D>("Interface/interface_barre");
            splashScreen = Content.Load<Texture2D>("comment_jouer");

            var bg = new TemporaryEffect (this, new Vector2 (), new MyTexture2D (_backGnd, 1), 1E20 /*beaucoup*/);
            bg.DrawOrder = -10;
            var fg = new TemporaryEffect (this, new Vector2 (), new MyTexture2D (Content.Load<Texture2D>("lumieres"), 1), 1E20 /*			beaucoup*/);
            fg.DrawOrder = 250;

            _gameOverTex[GameEndings.WIN_CAP] = Content.Load<Texture2D>("win_cap");
            _gameOverTex[GameEndings.WIN_COOK] = Content.Load<Texture2D>("win_cuistot");
            _gameOverTex[GameEndings.WIN_FISH] = Content.Load<Texture2D>("win_cireman");
            _gameOverTex[GameEndings.WIN_MECA] = Content.Load<Texture2D>("win_mecano");
            _gameOverTex[GameEndings.ALL_DEAD] = Content.Load<Texture2D>("game_over");
            _gameOverTex[GameEndings.EXPLODE] = Content.Load<Texture2D>("game_over");
            _gameOverTex[GameEndings.DERIVE] = Content.Load<Texture2D>("game_over");
            _gameOverTex[GameEndings.SHARE_GOLD] = Content.Load<Texture2D>("lose_screen");

            InitHelper.LoadAndSetRoomTextures (_rooms, Content);

            var captain = Content.Load<Texture2D>("Players/capitaine");
            var captainRun = Content.Load<Texture2D>("Players/capitaine_run");
            var captainDead = Content.Load<Texture2D>("Players/capitaine_mort");
            var captainDmg = Content.Load<Texture2D>("Players/capitaine_degats");
            var captainTextures = new Dictionary<PlayerState, MyTexture2D>
            {
                {PlayerState.STILL, new MyTexture2D(captain, 1)},
                {PlayerState.WALK, new MyTexture2D(captainRun, 4, new []{1000.0/12, 1000.0/12, 1000.0/12, 1000.0/12})},
                {PlayerState.HIT, new MyTexture2D(captainDmg, 9, new []{1000.0/12, 1000.0/12, 1000.0/12, 1000.0/12, 1000.0/12, 1000.0/12, 1000.0/12, 1000.0/12, 1000.0/12})},
                {PlayerState.DEAD, new MyTexture2D(captainDead, 1)},
            };
            var player1Controls = new Dictionary<Direction, Keys> {
                { Direction.LEFT, Keys.Left },
                { Direction.RIGHT, Keys.Right },
                { Direction.UP, Keys.Up },
                { Direction.DOWN, Keys.Down },
                { Direction.TRAP, Keys.NumPad0 },
                { Direction.ACTION, Keys.RightControl },
            };

            Players[PlayerType.CAP] = new Player (this, captainTextures, _rooms[RoomType.COMMANDS], player1Controls, PlayerIndex.Two);

            var mecano = Content.Load<Texture2D>("Players/mecano");
            var mecanoRun = Content.Load<Texture2D>("Players/mecano_run");
            var mecanoDegats = Content.Load<Texture2D>("Players/mecano_degats");
            var mecanoDead = Content.Load<Texture2D>("Players/mecano_mort");
            var mecanoTextures = new Dictionary<PlayerState, MyTexture2D>
            {
                {PlayerState.STILL, new MyTexture2D(mecano, 1)},
                {PlayerState.WALK, new MyTexture2D(mecanoRun, 4, new []{1000.0/12, 1000.0/12, 1000.0/12, 1000.0/12})},
                {PlayerState.HIT, new MyTexture2D(mecanoDegats, 9, new double[]{60, 60, 60, 60, 60, 60, 1000.0/12, 1000.0/12, 1000.0/12})},
                {PlayerState.DEAD, new MyTexture2D(mecanoDead, 1)},
            };
            var player2Controls = new Dictionary<Direction, Keys> {
                { Direction.LEFT, Keys.Q },
                { Direction.RIGHT, Keys.D },
                { Direction.UP, Keys.Z },
                { Direction.DOWN, Keys.S },
                { Direction.TRAP, Keys.E },
                { Direction.ACTION, Keys.A },
            };

            Players[PlayerType.MECA] = new Player (this, mecanoTextures, _rooms[RoomType.MACHINE], player2Controls, PlayerIndex.Three);

            if (!(_players > 1))
            {
                Players[PlayerType.MECA].Death();
                Players[PlayerType.MECA].Visible = false;
            }

            var cuisto = Content.Load<Texture2D>("Players/cuisto");
            var cuistoRun = Content.Load<Texture2D>("Players/cuisto_run");
            var cuistoDegat = Content.Load<Texture2D>("Players/cuistot_degats");
            var cuistoDead = Content.Load<Texture2D>("Players/cuisto_mort");
            var cuistoTextures = new Dictionary<PlayerState, MyTexture2D>
            {
                {PlayerState.STILL, new MyTexture2D(cuisto, 1)},
                {PlayerState.WALK, new MyTexture2D(cuistoRun, 4, new []{1000.0/12, 1000.0/12, 1000.0/12, 1000.0/12})},
                {PlayerState.HIT, new MyTexture2D(cuistoDegat, 9, new double[]{60, 60, 60, 60, 60, 60, 1000.0/12, 1000.0/12, 1000.0/12})},
                {PlayerState.DEAD, new MyTexture2D(cuistoDead, 1)},
            };
            var player3Controls = new Dictionary<Direction, Keys> {
                { Direction.LEFT, Keys.NumPad4 },
                { Direction.RIGHT, Keys.NumPad6},
                { Direction.UP, Keys.NumPad8 },
                { Direction.DOWN, Keys.NumPad5 },
                { Direction.TRAP, Keys.NumPad9 },
                { Direction.ACTION, Keys.NumPad7},
            };

            Players[PlayerType.COOK] = new Player(this, cuistoTextures, _rooms[RoomType.KITCHEN], player3Controls, PlayerIndex.One);

            if (!(_players > 2))
            {
                Players[PlayerType.COOK].Death();
                Players[PlayerType.COOK].Visible = false;
            }

            var cireman = Content.Load<Texture2D>("Players/cireman");
            var ciremanRun = Content.Load<Texture2D>("Players/cireman_run");
            var ciremanDegat = Content.Load<Texture2D>("Players/cireman_degats");
            var ciremanDead = Content.Load<Texture2D>("Players/cireman_mort");
            var ciremanTextures = new Dictionary<PlayerState, MyTexture2D>
            {
                {PlayerState.STILL, new MyTexture2D(cireman, 1)},
                {PlayerState.WALK, new MyTexture2D(ciremanRun, 4, new []{1000.0/12, 1000.0/12, 1000.0/12, 1000.0/12})},
                {PlayerState.HIT, new MyTexture2D(ciremanDegat, 9, new double[]{60, 60, 60, 60, 60, 60, 1000.0/12, 1000.0/12, 1000.0/12})},
                {PlayerState.DEAD, new MyTexture2D(ciremanDead, 1)},
            };
            var player4Controls = new Dictionary<Direction, Keys> {
                { Direction.LEFT, Keys.K },
                { Direction.RIGHT, Keys.M},
                { Direction.UP, Keys.O },
                { Direction.DOWN, Keys.L },
                { Direction.TRAP, Keys.P },
                { Direction.ACTION, Keys.I},
            };

            Players[PlayerType.FISH] = new Player(this, ciremanTextures, _rooms[RoomType.BRIDGE], player4Controls, PlayerIndex.Four);

            if (!(_players > 3))
            {
                Players[PlayerType.FISH].Death();
                Players[PlayerType.FISH].Visible = false;
            }

            _song = Content.Load<Song>("musique_off");
        }