Esempio n. 1
0
 private static void Main(string[] args)
 {
     using (CStrike2D game = new CStrike2D())
     {
         game.Run();
     }
 }
Esempio n. 2
0
 public LevelEditor(CStrikeModel model)
 {
     driver       = model.DriverInstance;
     input        = model.Input;
     CurrentState = EditorStates.Edit;
     driver.Model.Camera.Position = new Vector2(225, 250);
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes the view and loads all applicable assets
 /// </summary>
 /// <param name="assets"></param>
 public CStrikeView(CStrike2D driver)
 {
     assets             = driver.Assets;
     cullableRasterizer = new RasterizerState {
         ScissorTestEnable = true
     };
 }
Esempio n. 4
0
        public Assets(CStrike2D instance)
        {
            // Initialize Content Loaders
            coreContentLoader = new ContentManager(instance.Services);
            mapContentLoader  = new ContentManager(instance.Services);
            gameContentLoader = new ContentManager(instance.Services);

            coreContentLoader.RootDirectory = "Content";
            mapContentLoader.RootDirectory  = "Content";
            gameContentLoader.RootDirectory = "Content";

            GameContentLoaded = false;
        }
Esempio n. 5
0
        /// <summary>
        /// Renderer
        /// </summary>
        /// <param name="instance"></param>
        public ShaderRenderer(CStrike2D instance)
        {
            driver     = instance;
            assets     = driver.Assets;
            BlurAmount = 12f;

            PresentationParameters pp     = driver.GraphicsDevice.PresentationParameters;
            SurfaceFormat          format = pp.BackBufferFormat;

            int width  = 1280;
            int height = 720;

            sceneRender = new RenderTarget2D(driver.GraphicsDevice, width, height, false,
                                             format, pp.DepthStencilFormat, pp.MultiSampleCount,
                                             RenderTargetUsage.DiscardContents);

            width  /= 2;
            height /= 2;

            firstRender  = new RenderTarget2D(driver.GraphicsDevice, width, height, false, format, DepthFormat.None);
            secondRender = new RenderTarget2D(driver.GraphicsDevice, width, height, false, format, DepthFormat.None);

            matrix = Matrix.CreateOrthographicOffCenter(0,
                                                        instance.GraphicsDevice.PresentationParameters.BackBufferWidth,
                                                        instance.GraphicsDevice.PresentationParameters.BackBufferHeight,
                                                        0, 0, 1
                                                        );

            alphaEffect = new AlphaTestEffect(instance.GraphicsDevice)
            {
                Projection = matrix
            };

            stencilOne = new DepthStencilState
            {
                StencilEnable     = true,
                StencilFunction   = CompareFunction.Always,
                StencilPass       = StencilOperation.Replace,
                ReferenceStencil  = 1,
                DepthBufferEnable = false,
            };

            stencilTwo = new DepthStencilState
            {
                StencilEnable     = true,
                StencilFunction   = CompareFunction.LessEqual,
                StencilPass       = StencilOperation.Keep,
                ReferenceStencil  = 1,
                DepthBufferEnable = false,
            };
        }
Esempio n. 6
0
        /// <summary>
        /// Load core assets in this method
        /// </summary>
        public void LoadCoreContent(CStrike2D instance)
        {
            // Load Pixel texture
            PixelTexture = new Texture2D(instance.GraphicsDevice, 1, 1);
            PixelTexture.SetData(new [] { Color.White });

            // Load font
            DefaultFont = coreContentLoader.Load <SpriteFont>("font/defFont");

            // Load textures
            CTMenuBackground = coreContentLoader.Load <Texture2D>("texture/bg/ctmenu");
            TMenuBackground  = coreContentLoader.Load <Texture2D>("texture/bg/tmenu");

            CTTexture = coreContentLoader.Load <Texture2D>("texture/player/ct1");
            TTexture  = coreContentLoader.Load <Texture2D>("texture/player/t1");
            TileSet   = coreContentLoader.Load <Texture2D>("texture/map/dustTileSet");

            // Loads all sounds
            instance.Model.AudioManager.AddSound(new SoundContainer("menuMusic", coreContentLoader.Load <SoundEffect>("sound/music/mainmenu")));

            instance.Model.AudioManager.AddSound(new SoundContainer("ak47shot", coreContentLoader.Load <SoundEffect>("sound/sfx/weapon/ak47")));
            instance.Model.AudioManager.AddSound(new SoundContainer("ak47shotdistant", coreContentLoader.Load <SoundEffect>("sound/sfx/weapon/ak47d")));
            instance.Model.AudioManager.AddSound(new SoundContainer("m4a1shot", coreContentLoader.Load <SoundEffect>("sound/sfx/weapon/m4a1")));

            instance.Model.AudioManager.AddSound(new SoundContainer("buttonclick", coreContentLoader.Load <SoundEffect>("sound/sfx/ui/buttonclick")));
            instance.Model.AudioManager.AddSound(new SoundContainer("awpshot", coreContentLoader.Load <SoundEffect>("sound/sfx/weapon/awp")));
            instance.Model.AudioManager.AddSound(new SoundContainer("flashbang1", coreContentLoader.Load <SoundEffect>("sound/sfx/weapon/flashbang_explode1")));
            instance.Model.AudioManager.AddSound(new SoundContainer("flashbang2", coreContentLoader.Load <SoundEffect>("sound/sfx/weapon/flashbang_explode2")));

            instance.Model.AudioManager.AddSound(new SoundContainer("bombdef", coreContentLoader.Load <SoundEffect>("sound/sfx/radio/bombdef")));
            instance.Model.AudioManager.AddSound(new SoundContainer("bombpl", coreContentLoader.Load <SoundEffect>("sound/sfx/radio/bombpl")));
            instance.Model.AudioManager.AddSound(new SoundContainer("ctwin", coreContentLoader.Load <SoundEffect>("sound/sfx/radio/ctwin")));
            instance.Model.AudioManager.AddSound(new SoundContainer("rounddraw", coreContentLoader.Load <SoundEffect>("sound/sfx/radio/rounddraw")));
            instance.Model.AudioManager.AddSound(new SoundContainer("terwin", coreContentLoader.Load <SoundEffect>("sound/sfx/radio/terwin")));

            instance.Model.AudioManager.AddSound(new SoundContainer("pickup", coreContentLoader.Load <SoundEffect>("sound/sfx/player/pickup")));
            instance.Model.AudioManager.AddSound(new SoundContainer("death4", coreContentLoader.Load <SoundEffect>("sound/sfx/player/death4")));

            instance.Model.AudioManager.AddSound(new SoundContainer("footstep1", coreContentLoader.Load <SoundEffect>("sound/sfx/player/dirt1")));
            instance.Model.AudioManager.AddSound(new SoundContainer("footstep2", coreContentLoader.Load <SoundEffect>("sound/sfx/player/dirt2")));

            instance.Model.AudioManager.AddSound(new SoundContainer("hit2", coreContentLoader.Load <SoundEffect>("sound/sfx/player/kevlar2")));

            instance.Model.AudioManager.AddSound(new SoundContainer("roundStart", coreContentLoader.Load <SoundEffect>("sound/music/startaction_01")));

            BlurEffect = coreContentLoader.Load <Effect>("fx/blur");
        }
Esempio n. 7
0
        public CStrikeModel(CStrike2D driver, Vector2 center, Vector2 dimensions)
        {
            DriverInstance = driver;
            Center         = center;
            Dimensions     = dimensions;

            // Initialize AudioManager
            AudioManager = new AudioManager();

            // Initialize UIManager
            InterfaceManager = new UIManager();

            // Initialize Control Class
            Input = new InputManager();

            // Initialize Random number generator
            NumGen = new Random();

            GameEngine = new GameEngine(DriverInstance);

            NetworkManager = new NetworkManager(GameEngine);

            Shader = new ShaderRenderer(driver);
        }
Esempio n. 8
0
 /// <summary>
 /// Driver class for in-game logic
 /// </summary>
 /// <param name="driver"></param>
 public GameEngine(CStrike2D driver)
 {
     this.driver = driver;
     CurState    = GameEngineState.InActive;
 }