예제 #1
0
        public Missile(ParentGame game, Model modelObj, Texture2D[] modelTextures, DrawingClass drawClass, GameplayScreen Screen)
            : base(game, modelObj, modelTextures)
        {
            this.drawClass = drawClass;
            this.Screen = Screen;

            _body = new Body();
            _skin = new CollisionSkin(_body);
            _body.CollisionSkin = _skin;

            Box box = new Box(Vector3.Zero, Matrix.Identity, new Vector3(1f,1f,4f));
            _skin.AddPrimitive(box, new MaterialProperties(0.8f, 0.8f, 0.7f));

            Vector3 com = SetMass(2.0f);

            _body.MoveTo(position, Matrix.Identity);
            _skin.ApplyLocalTransform(new Transform(-com, Matrix.Identity));
            _body.EnableBody();

            Body.ExternalData = this;

            Vector3 pos = position;
            Vector3 forwardVec = Body.Orientation.Forward;
            forwardVec.Normalize();

            pos -= forwardVec * 10;
            // Use the particle emitter helper to output our trail particles.
            trailEmitter = new ParticleEmitter(drawClass.projectileTrailParticles,
                                               trailParticlesPerSecond, position);

            rgob = new RagdollObject(parentGame, null, null, null, RagdollObject.RagdollType.Simple, 1.0f, 3);
            rgob.Position = position;
            //rgob.PutToSleep();

            //rgob.limbs[0].PhysicsBody.AngularVelocity = (new Vector3(1, 1, 0) * 2000);

            RagdollTransforms = new List<Matrix>();

            RagdollTransforms = rgob.GetWorldMatrix();

            foreach (JigLibX.Objects.PhysicObject lim in rgob.limbs)
                DisableCollisions(lim.PhysicsBody, Body);

            foreach (JigLibX.Objects.PhysicObject lim in rgob.limbs)
                foreach (BuildingPiece pic in Screen.PieceList)
                    DisableCollisions(lim.PhysicsBody, pic.Body);

            foreach (JigLibX.Objects.PhysicObject lim in rgob.limbs)
                foreach (Building bld in Screen.Buildings)
                    DisableCollisions(lim.PhysicsBody, bld.Body);

            foreach (JigLibX.Objects.PhysicObject lim in rgob.limbs)
                DisableCollisions(lim.PhysicsBody, Screen.terrainActor.Body);

            foreach (JigLibX.Objects.PhysicObject limb0 in rgob.limbs)
                foreach (Missile mis in Screen.BulletList)
                    foreach (JigLibX.Objects.PhysicObject limb1 in mis.rgob.limbs)
                        DisableCollisions(limb1.PhysicsBody, limb0.PhysicsBody);
        }
예제 #2
0
        public GameObject(ParentGame game, Model modelObj, Texture2D[] modelTextures)
        {
            parentGame = game;

            model = modelObj;
            textures = modelTextures;

            boundSphere = new BoundingSphere();
            boundSphere.Radius = 5;
        }
예제 #3
0
 public PlayerTank(ParentGame Game, Model ModelObj, Texture2D[] ModelTextures, Vector3 Position,
     Model MissileModel, Texture2D[] MissileTextures, GameScreen Screen)
     : base(Game, ModelObj, ModelTextures)
 {
     this.Screen = Screen;
     //LoadPhysicsObject();
     missileModel = MissileModel;
     missileTextures = MissileTextures;
     position = Position;
 }
예제 #4
0
 /// <summary>
 /// Constructor fills in the menu contents.
 /// </summary>
 /// 
 public LevelSelectScreen(ParentGame parentGame)
     : base("Artillery Fantastic")
 {
     NormalMode = parentGame.NormalMode;
     Initialize(parentGame);
     parentGame.LevelNum = 0;
     if(NormalMode)
         base.menuTitle = Mode1;
     else
         base.menuTitle = Mode2;
 }
예제 #5
0
        public TerrainEditor(ParentGame parentGame,
            GameplayScreen gameScreen, TerrainEngine terrainEngine)
        {
            this.parentGame = parentGame;
            this.gameScreen = gameScreen;
            this.terrainEngine = terrainEngine;

            posList = new List<Vector3>();
            vectorList = new List<int>();
            BigChangeList = new List<int>();
        }
예제 #6
0
 /// <summary>
 /// Constructor fills in the menu contents.
 /// </summary>
 /// 
 public MainMenuScreen(ParentGame parentGame)
     : base("Artillery Fantastic")
 {
     NormalMode = parentGame.NormalMode;
     Initialize(parentGame);
     parentGame.LevelNum = 0;
     selectTexture = parentGame.MenuVariables.MenuSelect;
     if(NormalMode)
         base.menuTitle = Mode1;
     else
         base.menuTitle = Mode2;
 }
예제 #7
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            //using (Game1 game = new Game1())
            //{
            //    game.Run();
            //}

            using (ParentGame game = new ParentGame())
            {
                game.Run();
            }
        }
예제 #8
0
        public BuildingPiece(ParentGame game, Model modelObj, Texture2D[] modelTextures,
            DrawingClass drawClass, GameplayScreen Screen, float Length, float Width, float Height)
            : base(game, modelObj, modelTextures)
        {
            // Use the particle emitter helper to output our trail particles.
            trailEmitter = new ParticleEmitter(drawClass.smokePlumeParticles,
                                               3, position);

            fireEmitter = new ParticleEmitter(drawClass.fireParticles,
                                               30, position);

            this.Screen = Screen;
            this.drawClass = drawClass;

            _body = new Body();
            _skin = new CollisionSkin(_body);
            _body.CollisionSkin = _skin;

            //Box box = new Box(Vector3.Zero, Matrix.Identity, new Vector3(10f, 7f, 7f));
            Box box = new Box(Vector3.Zero, Matrix.Identity, new Vector3(Length, Width, Height));
            if (Length > Width && Length > Height)
                boundSphere.Radius = Length;
            else if (Width > Length && Width > Height)
                boundSphere.Radius = Width;
            else
                boundSphere.Radius = Height;
            _skin.AddPrimitive(box, new MaterialProperties(0.8f, 0.8f, 0.7f));

            Vector3 com = SetMass(3.0f);

            _body.MoveTo(position, Matrix.Identity);
            _skin.ApplyLocalTransform(new Transform(-com, Matrix.Identity));
            _body.EnableBody();

            Body.ExternalData = this;

            SetBody(rotation);

            Body.AllowFreezing = true;
            Body.SetDeactivationTime(1);

            foreach (BuildingPiece pic in Screen.PieceList)
                DisableCollisions(this.Body, pic.Body);

            foreach (Building bld in Screen.Buildings)
                DisableCollisions(this.Body, bld.Body);
        }
예제 #9
0
        public Building(ParentGame game, Model modelObj, Texture2D[] modelTextures,
            Vector3 Position, float Scale, Vector3 Rotation, string Type, GameplayScreen Screen)
            : base(game, modelObj, modelTextures)
        {
            // Use the particle emitter helper to output our trail particles.
            //trailEmitter = new ParticleEmitter(parentGame.projectileTrailParticles,
            //                                   trailParticlesPerSecond, position);

            this.Screen = Screen;
            this.drawClass = Screen.NormalDrawing;
            this.Type = Type;

            position = Position;
            scale = Scale;
            rotation = Rotation;

            Initialize();
        }
예제 #10
0
        public TerrainEngine(ParentGame game, MouseCamera mouseCam, TerrainArguments terrainArgs)
        {
            this.device = game.GraphicsDevice;
            parentGame = game;

            heightMap = terrainArgs.heightMap;
            terrainTexture = terrainArgs.terrainTexture1;
            terrainTexture0 = terrainArgs.terrainTexture2;
            terrainTexture1 = terrainArgs.terrainTexture3;
            terrainTexture2 = terrainArgs.terrainTexture4;
            decalTexture = terrainArgs.decalTexture;
            terrainScale = terrainArgs.terrainScale;

            skyDome = terrainArgs.skyDome;
            cloudMap = terrainArgs.skyTexture;
            //#if!XBOX
            //            sw = new StreamWriter("C:/Temp_Heights" + parentGame.LevelNum + ".jpeg");
            //#endif
        }
예제 #11
0
        //public LoadingStage(ResourceList res_list, ParentGame parentGame)
        //{
        //    ContMang = parentGame.Content;
        //    theList = res_list;
        //    MODEL_EFFECT = parentGame.objEffect;
        //    DEVICE = parentGame.device;
        //    Type = StageType.Loading;
        //    Tex2dLoadList = new Dictionary<String, bool>();
        //    ModelLoadList = new Dictionary<String, bool>();
        //    SetThreads();
        //   // LoadContent();
        //   // EndLoading();
        //}
        /// <summary>
        /// Previously, an old resourse list could be used and modified with new content, 
        /// however, I have changed it to create a new ContentManager for each load, and 
        /// consequently, a new resource list is required for each load... until i fix it.
        /// </summary>
        /// <param name="res_list"></param>
        /// <param name="parentGame"></param>
        /// <param name="initialLoad"></param>
        public LoadingStage(ResourceList res_list, ParentGame parentGame, bool initialLoad)
        {
            if (initialLoad)
                ContMang = parentGame.Content;
            else
                ContMang = new ContentManager(parentGame.Services, "Content");

            theList = res_list;
            MODEL_EFFECT = parentGame.objEffect;
            DEVICE = parentGame.device;

            InitialLoad = initialLoad;
            this.parentGame = parentGame;

            Type = StageType.Loading;

            Tex2dLoadList = new Dictionary<String, bool>();
            ModelLoadList = new Dictionary<String, bool>();

            SetThreads();

            // LoadContent();
            // EndLoading();
        }
예제 #12
0
 public MouseCamera(ParentGame game)
 {
     this.device = game.GraphicsDevice;
     parentGame = game;
 }
예제 #13
0
 /// <summary>
 /// Constructor fills in the menu contents.
 /// </summary>
 /// 
 public MainMenuTime(ParentGame parentGame)
     : base("Terrific Game")
 {
     Initialize(parentGame);
     parentGame.LevelNum = 0;
 }
예제 #14
0
 public Ring(ParentGame game, Model modelObj, Texture2D[] modelTextures, 
     Vector3 Position, float Scale, Vector3 Rotation, string Type, GameplayScreen Screen)
     : base(game, modelObj, modelTextures,
     Position, Scale, Rotation, Type, Screen)
 {
 }
예제 #15
0
 public FollowCam(ParentGame game, PlayerTank player)
 {
     this.device = game.GraphicsDevice;
     parentGame = game;
     Player = player;
 }
예제 #16
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public GameplayScreen(NetworkSession networkSession, ParentGame parentGame)
        {
            this.networkSession = networkSession;

            this.parentGame = parentGame;

            sessionState = SessionState.Loading;

            TransitionOnTime = TimeSpan.FromSeconds(0.2);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);
        }
예제 #17
0
        void Initialize(ParentGame parentGame)
        {
            for (int i = 0; i < 12; ++i)
            {
                MenuEntry me = new MenuEntry((i + 1).ToString());
                me.LevelNum = (i + 1);
                me.Selected += SinglePlayerMenuEntrySelected;
                MenuEntries.Add(me);
            }

            Level = parentGame.Content.Load<Texture2D>("Menu\\level");
            Clear = parentGame.Content.Load<Texture2D>("Menu\\clear");
            Locked = parentGame.Content.Load<Texture2D>("Menu\\locked");
            ButtonA = parentGame.Content.Load<Texture2D>("Menu\\buttona");
            ButtonB = parentGame.Content.Load<Texture2D>("Menu\\buttonb");
        }
예제 #18
0
        /// <summary>
        /// Unload graphics content used by the game.
        /// </summary>
        public override void UnloadContent()
        {
            List<Body> Bodies = new List<Body>();
            foreach (Body body in PhysicsSystem.CurrentPhysicsSystem.Bodies)
                Bodies.Add(body);

            foreach (Body body in Bodies)
                PhysicsSystem.CurrentPhysicsSystem.RemoveBody(body);

            List<CollisionSkin> Skins = new List<CollisionSkin>();
            foreach (CollisionSkin skin in PhysicsSystem.CurrentPhysicsSystem.CollisionSystem.CollisionSkins)
                Skins.Add(skin);

            foreach (CollisionSkin skin in Skins)
                PhysicsSystem.CurrentPhysicsSystem.CollisionSystem.RemoveCollisionSkin(skin);

            parentGame.Components.Remove(terrainActor);
            terrainActor.Dispose();

            NormalDrawing.Unload();
            terrainEngine.Unload();

            Player.baseRotationValue = 0;
            Player.cannonRotationValue = 0;
            Player.turretRotationValue = 0;

            Player.baseBone.Transform = Matrix.Identity;
            Player.Unload();

            Player = null;
            MouseCam = null;
            terrainEngine = null;

            //LevelVars = null;
            NormalDrawing = null;

            //ambieCue = parentGame.soundBank.GetCue("ambient");
            //ambieCue.Stop(AudioStopOptions.Immediate);

            if (ambieCue != null && ambieCue.IsPlaying)
                ambieCue.Stop(AudioStopOptions.Immediate);

            if (birdCue.IsCreated && birdCue.IsPlaying)
                birdCue.Stop(AudioStopOptions.Immediate);

            if (cue != null && cue.IsPlaying)
                cue.Stop(AudioStopOptions.Immediate);

            SetScore();

            #if XBOX
            parentGame.SaveGame();
            #endif

            parentGame = null;

            content.Unload();
        }
예제 #19
0
        void Initialize(ParentGame parentGame)
        {
            // Create our menu entries.
            MenuEntry continueEntry = new MenuEntry("Continue");
            continueEntry.LevelNum = 0;
            continueEntry.Selected += SinglePlayerMenuEntrySelected;
            MenuEntries.Add(continueEntry);

            MenuEntry mode = new MenuEntry("Time Trial Mode");
            mode.LevelNum = 0;
            mode.Selected += ModeSelected;
            MenuEntries.Add(mode);

            for (int i = 0; i < 12; ++i)
            {
                MenuEntry me = new MenuEntry((i+1).ToString());
                me.LevelNum = (i + 1);
                me.Selected += SinglePlayerMenuEntrySelected;
                MenuEntries.Add(me);
            }

            MenuEntry exitMenuEntry = new MenuEntry(Resources.Exit);
            exitMenuEntry.Selected += OnCancel;
            MenuEntries.Add(exitMenuEntry);

            Level = parentGame.Content.Load<Texture2D>("Menu\\level");
            Clear = parentGame.Content.Load<Texture2D>("Menu\\clear");
            Locked = parentGame.Content.Load<Texture2D>("Menu\\locked");
        }
예제 #20
0
 public LevelLoader(ParentGame parentGame)
 {
     this.parentGame = parentGame;
     Load_Stage = parentGame.Loading_Stage;
     this.LoadedResources = parentGame.LoadedResources;
 }
예제 #21
0
        public DrawingClass(ParentGame parentGame, GameplayScreen levelVariables,
            List<Missile> BulletList, List<Building> BuildingList, List<BuildingPiece> PieceList)
        {
            this.parentGame = parentGame;
            this.LV = levelVariables;
            this.BulletList = BulletList;
            this.BuildingList = BuildingList;
            this.PieceList = PieceList;

            device = parentGame.GraphicsDevice;
            PresentationParameters PP = device.PresentationParameters;
            spriteBatch = parentGame.spriteBatch;

            windowHeight = PP.BackBufferHeight;
            windowWidth = PP.BackBufferWidth;

            objEffect = parentGame.objEffect;
            //shadowMapShader = parentGame.Content.Load<Effect>("Effect\\DrawShadowMap");
            GausBlur = parentGame.Content.Load<Effect>("Effect\\GaussianBlur");
            effectPostDoF = parentGame.Content.Load<Effect>("Effect\\PostProcessDoF");
            depthMapShader = parentGame.Content.Load<Effect>("Effect\\Shader");
            font = parentGame.Content.Load<SpriteFont>("Font\\SpriteFont1");
            Lines = parentGame.Content.Load<Texture2D>("Radar\\lines3");
            Post = parentGame.Content.Load<Texture2D>("Radar\\post_screen");
            PowerBar = parentGame.Content.Load<Texture2D>("Radar\\power_bar");
            PowerCase = parentGame.Content.Load<Texture2D>("Radar\\power_case");
            Bullets = parentGame.Content.Load<Texture2D>("Radar\\bullets");
            Angle = parentGame.Content.Load<Texture2D>("Radar\\angle");
            WinBack = parentGame.Content.Load<Texture2D>("WinLoose\\win_back");
            LooseBack = parentGame.Content.Load<Texture2D>("WinLoose\\loose_back");
            TitlesFont = parentGame.Content.Load<SpriteFont>("Font\\sten36bld");
            TitlesFont2 = parentGame.Content.Load<SpriteFont>("Font\\Titles_font2");
            FireworkSheet = parentGame.Content.Load<Texture2D>("Firework\\firework_sheet");
            Timer = parentGame.Content.Load<Texture2D>("Radar\\timer");

            blurredScene = new Texture2D(device, windowWidth, windowHeight);
            depthTexture = new Texture2D(device, windowWidth, windowHeight);
            sceneTexture = new Texture2D(device, windowWidth, windowHeight);

            InitializeRenderTargets();

            InitializeParticles();

            lightPower = 0.9f;
            ambientPower = 0.2f;

            debugDrawer = new DebugDrawer(parentGame);
            debugDrawer.Enabled = true;
            parentGame.Components.Add(debugDrawer);

            SpecularColor = Color.Purple.ToVector4();
            SpecularIntensity = 1.0f;
            Shinniness        = 500.0f;

            float screenscale =
                (float)device.Viewport.Width / 848f;
            // Create the scale transform for Draw.
            // Do not scale the sprite depth (Z=1).
            SpriteScale = Matrix.CreateScale(screenscale, screenscale, 1);

            ssX = screenscale;

            WLScale.X = (float)device.Viewport.Width / 800f;
            WLScale.Y = (float)device.Viewport.Height / 600f;

            InitializeBones();
            boundFrustum = new BoundingFrustum(viewMatrix * projectionMatrix);
        }
예제 #22
0
        void Initialize(ParentGame parentGame)
        {
            // Create our menu entries.
            MenuEntry continueEntry = new MenuEntry("Continue");
            continueEntry.LevelNum = 0;
            continueEntry.Selected += SinglePlayerMenuEntrySelected;
            MenuEntries.Add(continueEntry);

            MenuEntry mode = new MenuEntry(Mode2);
            if (!NormalMode)
                mode.Text = Mode1;
            mode.LevelNum = 0;
            mode.Selected += ModeSelected;
            MenuEntries.Add(mode);

            MenuEntry levelSelect = new MenuEntry("Level Select");
            levelSelect.Selected += LevelSelectSelected;
            MenuEntries.Add(levelSelect);

            MenuEntry options = new MenuEntry("Options");
            //levelSelect.Selected += LevelSelectSelected;
            MenuEntries.Add(options);

            MenuEntry exitMenuEntry = new MenuEntry(Resources.Exit);
            exitMenuEntry.Selected += OnCancel;
            MenuEntries.Add(exitMenuEntry);

            Level = parentGame.Content.Load<Texture2D>("Menu\\level");
            Clear = parentGame.Content.Load<Texture2D>("Menu\\clear");
            Locked = parentGame.Content.Load<Texture2D>("Menu\\locked");
            ButtonA = parentGame.Content.Load<Texture2D>("Menu\\buttona");
            ButtonB = parentGame.Content.Load<Texture2D>("Menu\\buttonb");

            //if (parentGame.LoadingLevel)
            //    parentGame.LoadingLevel = false;
        }
예제 #23
0
 public EnemyTank(ParentGame game, Model modelObj, Texture2D[] modelTextures)
     : base(game, modelObj, modelTextures)
 {
 }