Example #1
0
        public SeaTurtle()
            : base()
        {
            lastAttack = PoseidonGame.playTime;
            // Cool down 10s
            timeBetweenAttack = new TimeSpan(0, 0, 1);

            // Cool down 5s for the skill
            coolDown = new TimeSpan(0, 0, 5);
            lastCast = PoseidonGame.playTime;

            // Cool down 20s
            standingTime = new TimeSpan(0, 0, 1);

            isBigBoss = false;

            maxHealth = GameConstants.TurtleStartingHealth;
            health = maxHealth;

            if (HydroBot.gameMode == GameMode.ShipWreck)
                particleManager = ShipWreckScene.particleManager;
            else if (HydroBot.gameMode == GameMode.MainGame)
                particleManager = PlayGameScene.particleManager;
            else if (HydroBot.gameMode == GameMode.SurvivalMode)
                particleManager = SurvivalGameScene.particleManager;

            speedFactor = 1.5f + (HydroBot.seaCowPower - 1) / 4;
        }
Example #2
0
 public Trash( TrashType trashtype, ParticleManagement particleManager)
     : base()
 {
     sinking = false;
     sinkableTrash = false;
     trashType = trashtype;
     this.particleManager = particleManager;
     lastAddToxicParticle = PoseidonGame.playTime.TotalMilliseconds;
 }
Example #3
0
 public ResearchFacility(ParticleManagement particleManager)
     : base()
 {
     facilityCreationTime = PoseidonGame.playTime.TotalSeconds;
     random = new Random();
     bioUpgrade = plasticUpgrade = false;
     listTimeRockProcessing = new List<double>();
     underConstruction = true;
     constructionIndex = 0;
     lastConstructionSwitchTime = TimeSpan.Zero;
     constructionSwitchSpan = TimeSpan.FromSeconds(3);
     this.particleManager = particleManager;
     //buildingSoundInstance = PoseidonGame.audio.buildingSound.CreateInstance();
 }
Example #4
0
        public Terminator(GameMode gameMode)
            : base()
        {
            speed = (float)(GameConstants.EnemySpeed * 1.5);
            damage = GameConstants.TerminatorShootingDamage;
            timeBetweenFire = 0.3f;
            isBigBoss = true;
            random = new Random();
            //Terminator is undefeatable before the last level
            if (PlayGameScene.currentLevel == 11 || gameMode == GameMode.SurvivalMode)
            {
                health = 10000;
            }
            else
            {
                health = 1000000;
            }
            //if (PlayGameScene.currentLevel > 10)
            //    perceptionRadius = GameConstants.BossPerceptionRadius * (HydroBot.gamePlusLevel + 1);
            //else
            perceptionRadius = GameConstants.BossPerceptionRadius;
            if (PoseidonGame.capturingCinematic) perceptionRadius *= 200;
            basicExperienceReward = 3000;

            if (PoseidonGame.gamePlus)
            {
                speed *= (1.0f + (float)HydroBot.gamePlusLevel / 4);
                damage *= (HydroBot.gamePlusLevel + 1);
                timeBetweenFire /= (1 + (float)HydroBot.gamePlusLevel * 0.25f);
                basicExperienceReward *= (HydroBot.gamePlusLevel + 1);
                health += (HydroBot.gamePlusLevel * 5000);
                timeBetweenPowerUse /= (1 + (float)HydroBot.gamePlusLevel * 0.25f);
            }
            maxHealth = health;

            if (gameMode == GameMode.MainGame)
            {
                this.particleManager = PlayGameScene.particleManager;
            }
            else if (gameMode == GameMode.ShipWreck)
            {
                this.particleManager = ShipWreckScene.particleManager;
            }
            else if (gameMode == GameMode.SurvivalMode)
            {
                this.particleManager = SurvivalGameScene.particleManager;
            }
        }
Example #5
0
        public Factory(FactoryType factorytype, ParticleManagement particleManager, GraphicsDevice graphicsDevice)
            : base()
        {
            this.factoryType = factorytype;
            this.graphicsDevice = graphicsDevice;
            numTrashWaiting = 0;
            listTimeTrashProcessing = new List<double>();
            random = new Random();
            partId = -1; // Logic to Draw animated sprites depends on positive partID
            cycleTime = TimeSpan.FromMilliseconds(500.0);
            lastCycledTime = TimeSpan.Zero;
            currentTextureIndex = 0;
            currentFogColor = Vector3.One;

            // building construction state management
            underConstruction = true;
            constructionIndex = 0;
            lastConstructionSwitchTime = TimeSpan.Zero;
            constructionSwitchSpan = TimeSpan.FromSeconds(3);
            this.particleManager = particleManager;
            //buildingSoundInstance = PoseidonGame.audio.buildingSound.CreateInstance();

            //for animating trash processing
            switch (factoryType)
            {
                // These part id's were found out by experimentation. If we happen to change the model in future,
                // I'll need to find these part ids again. So, I have made them configurable from GameConstant
                case FactoryType.biodegradable:
                    partId = GameConstants.biofactoryPartId;
                    break;
                case FactoryType.radioactive:
                    partId = GameConstants.nuclearfactoryPartId;
                    break;
                case FactoryType.plastic:
                    partId = GameConstants.plasticfactoryPartId;
                    break;
            }
        }
Example #6
0
        public void Load()
        {
            statsFont = IngamePresentation.statsFont;
            menuSmall = IngamePresentation.menuSmall;
            fishTalkFont = IngamePresentation.fishTalkFont;

            // Get the audio library
            audio = (AudioLibrary)
                Game.Services.GetService(typeof(AudioLibrary));

            terrain = new Terrain(Content);

            skillTextures = IngamePresentation.skillTextures;
            bulletTypeTextures = IngamePresentation.bulletTypeTextures;

            powerpacks = new List<Powerpack>();
            resources = new List<Resource>();

            powerpacks = new List<Powerpack>();
            resources = new List<Resource>();

            hydroBot.Load(Content);

            //prevTank.Load(Content);
            roundTimer = roundTime;

            PresentationParameters pp = graphics.GraphicsDevice.PresentationParameters;
            renderTarget = new RenderTarget2D(graphics.GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight,
                false, graphics.GraphicsDevice.DisplayMode.Format, DepthFormat.Depth24Stencil8);
            afterEffectsAppliedRenderTarget = new RenderTarget2D(graphics.GraphicsDevice, pp.BackBufferWidth, pp.BackBufferHeight,
                false, graphics.GraphicsDevice.DisplayMode.Format, DepthFormat.Depth24Stencil8);

            //for edge detection effect
            normalDepthRenderTargetLow = new RenderTarget2D(graphics.GraphicsDevice,
                                                         pp.BackBufferWidth, pp.BackBufferHeight, false,
                                                         pp.BackBufferFormat, pp.DepthStencilFormat);
            normalDepthRenderTargetHigh = new RenderTarget2D(graphics.GraphicsDevice,
                                             pp.BackBufferWidth, pp.BackBufferHeight, false,
                                             pp.BackBufferFormat, pp.DepthStencilFormat);
            edgeDetectionRenderTarget = new RenderTarget2D(graphics.GraphicsDevice,
                                                         pp.BackBufferWidth, pp.BackBufferHeight, false,
                                                         pp.BackBufferFormat, pp.DepthStencilFormat);

            graphicEffect = new GraphicEffect(this, this.spriteBatch, fishTalkFont);
            // Construct our particle system components.
            particleManager = new ParticleManagement(this.game, GraphicDevice);

            // Load lower left pannel button
            factoryPanelTexture = IngamePresentation.factoryPanelTexture;
            // Load Font for displaying extra information on factory panel
            factoryPanelFont = IngamePresentation.factoryPanelFont;

            // Load textures for partid animation for factories
            biofactoryAnimationTextures = IngamePresentation.biofactoryAnimationTextures;
            nuclearFactoryAnimationTextures = IngamePresentation.nuclearFactoryAnimationTextures;

            // Load factory and research lab models
            plasticFactoryModelStates = new List<Model>();
            biodegradableFactoryModelStates = new List<Model>();
            radioactiveFactoryModelStates = new List<Model>();
            researchBuildingModelStates = new List<Model>();
            int totalStates = 4;
            for (int i = 0; i < totalStates; i++)
            {
                plasticFactoryModelStates.Add(Content.Load<Model>("Models/FactoryModels/PlasticFactory_stage" + i));
                biodegradableFactoryModelStates.Add(Content.Load<Model>("Models/FactoryModels/BiodegradableFactory_stage" + i));
                radioactiveFactoryModelStates.Add(Content.Load<Model>("Models/FactoryModels/NuclearFactory_stage" + i));
                researchBuildingModelStates.Add(Content.Load<Model>("Models/FactoryModels/ResearchFacility_stage" + i));
            }
            radioactiveFactoryModel = radioactiveFactoryModelStates[radioactiveFactoryModelStates.Count - 1];
            researchBuildingModel = researchBuildingModelStates[researchBuildingModelStates.Count - 1];
            biodegradableFactoryModel = biodegradableFactoryModelStates[biodegradableFactoryModelStates.Count - 1];
            plasticFactoryModel = plasticFactoryModelStates[plasticFactoryModelStates.Count - 1];

            // Factory level textures
            plasticFactoryLevelTextures = IngamePresentation.plasticFactoryLevelTextures;
            biodegradableFactoryLevelTextures = IngamePresentation.biodegradableFactoryLevelTextures;

            // Load Trash
            biodegradableTrash = Content.Load<Model>("Models/TrashModels/biodegradableTrashVer4");
            plasticTrash = Content.Load<Model>("Models/TrashModels/plasticTrashVer3");
            radioactiveTrash = Content.Load<Model>("Models/TrashModels/radioactiveTrash");

            //Load Powerpacks
            powerpackModels = new Model[5];
            powerpackModels[1] = Content.Load<Model>("Models/PowerpackResource/speedPowerPack");
            powerpackModels[2] = Content.Load<Model>("Models/PowerpackResource/strengthPowerPack");
            powerpackModels[3] = Content.Load<Model>("Models/PowerpackResource/shootratePowerPack");
            powerpackModels[4] = Content.Load<Model>("Models/PowerpackResource/healthPowerPack");

            //Load Resource
            resourceModel = Content.Load<Model>("Models/PowerpackResource/resource");

            //Load Strange Rock
            strangeRockModels = new Model[2];
            strangeRockModels[0] = Content.Load<Model>("Models/Miscellaneous/strangeRock1Ver2");
            strangeRockModels[1] = Content.Load<Model>("Models/Miscellaneous/strangeRock2Ver2");

            //golden key
            //goldenKey = Content.Load<Model>("Models/Miscellaneous/Goldenkey");

            //Initialize the game field
            InitializeGameField(Content);
        }
Example #7
0
        public void initialize(Vector3 position, Vector3 headingDirection, float speed,
            int damage, GameObject target, BaseEnemy shooter, GameMode gameMode)
        {
            base.initialize(position, headingDirection, speed, damage, shooter);
            this.unitDirection = headingDirection; //target.Position - position;
            this.unitDirection.Normalize();
            this.forwardDir = shooter.ForwardDirection;
            this.gameMode = gameMode;
            if (gameMode == GameMode.MainGame)
            {
                this.particleManager = PlayGameScene.particleManager;
            }
            else if (gameMode == GameMode.ShipWreck)
            {
                this.particleManager = ShipWreckScene.particleManager;
            }
            else if (gameMode == GameMode.SurvivalMode)
            {
                this.particleManager = SurvivalGameScene.particleManager;
            }

            // Use the particle emitter helper to output our trail particles.
            trailEmitter = new ParticleEmitter(particleManager.projectileTrailParticles,
                                               GameConstants.trailParticlesPerSecond, position);
        }
Example #8
0
        public static Vector3 createSinkingTrash(
            ref List<Trash> trashes, ContentManager Content, Random random, List<ShipWreck> shipWrecks, List<StaticObject> staticObjects, List<Factory> factories, ResearchFacility researchFacility, int minX, int maxX, int minZ, int maxZ, float floatHeight, HeightMapInfo heightMapInfo,ref Model bioTrash,ref Model plasticTrash,ref Model nukeTrash, ParticleManagement particleManager)
        {
            if (PoseidonGame.playTime.TotalSeconds - lastTrashDrop <= 10)
                return Vector3.Zero;
            else lastTrashDrop = PoseidonGame.playTime.TotalSeconds;

            Vector3 tempCenter;
            int numTries = 0, xVal, zVal, heightValue;
            float orientation = random.Next(100);
            int trash_type = random.Next(50);
            Trash sinkingTrash;
            if (trash_type < 30)
            {
                sinkingTrash = new Trash(TrashType.biodegradable, particleManager);
                sinkingTrash.Load(Content,ref bioTrash, orientation);
                sinkingTrash.sinkingRate = 0.25f;
                sinkingTrash.sinkingRotationRate = 0.015f;
            }
            else if (trash_type < 48)
            {
                sinkingTrash = new Trash(TrashType.plastic, particleManager);
                sinkingTrash.Load(Content,ref plasticTrash, orientation); //nuclear model
                sinkingTrash.sinkingRate = 0.35f;
                sinkingTrash.sinkingRotationRate = -0.015f;
            }
            else
            {
                sinkingTrash = new Trash(TrashType.radioactive, particleManager);
                sinkingTrash.Load(Content,ref nukeTrash, orientation); //nuclear model
                sinkingTrash.sinkingRate = 0.6f;
                sinkingTrash.sinkingRotationRate = 0.025f;
            }
            sinkingTrash.sinking = true;
            sinkingTrash.sinkableTrash = true;
            do
            {
                //positionSign = random.Next(4);
                xVal = random.Next(0, 2 * maxX) - maxX;
                zVal = random.Next(0, 2 * maxZ) - maxZ;
                //switch (positionSign)
                //{
                //    case 0:
                //        xVal *= -1;
                //        break;
                //    case 1:
                //        zVal *= -1;
                //        break;
                //    case 2:
                //        xVal *= -1;
                //        zVal *= -1;
                //        break;
                //}
                heightValue = (int)heightMapInfo.GetHeight(new Vector3(xVal, 0, zVal));
                numTries++;
            } while (IsSeaBedPlaceOccupied(xVal, GameConstants.MainGameFloatHeight, zVal, 30, shipWrecks, staticObjects, trashes, factories, researchFacility) && numTries < GameConstants.MaxNumTries);

            sinkingTrash.Position.X = xVal;
            sinkingTrash.Position.Z = zVal;
            sinkingTrash.Position.Y = floatHeight+100;
            sinkingTrash.seaFloorHeight = heightMapInfo.GetHeight(new Vector3(sinkingTrash.Position.X, 0, sinkingTrash.Position.Z));//GameConstants.TrashFloatHeight;
            tempCenter = sinkingTrash.BoundingSphere.Center;
            tempCenter.X = sinkingTrash.Position.X;
            tempCenter.Y = floatHeight;
            tempCenter.Z = sinkingTrash.Position.Z;
            sinkingTrash.BoundingSphere = new BoundingSphere(tempCenter,sinkingTrash.BoundingSphere.Radius);
            trashes.Add(sinkingTrash);

            //degrade environment
            HydroBot.currentEnvPoint -= (int)((float)GameConstants.envLossPerTrashAdd / 2);

            return sinkingTrash.Position;
        }