Example #1
0
 public override void draw(GraphicsDevice device, Effect effect, DisplayParameters parameters)
 {
     foreach (BlockLoc test in blocksToBeRemoved)
     {
         WorldMarkupHandler.addCharacter(ContentDistributor.getEmptyString() + @"worldMarkup\redCubeOutline.chr",
                                         test.toWorldSpaceVector3() + new Vector3(.5f, .5f, .5f), 1.1f / 7f, .6f);
     }
 }
Example #2
0
 public Boat(Vector3 nLoc)
 {
     nLoc += new Vector3(.5f, 0, .5f);
     setupAnimatedBodyPartGroup(ContentDistributor.getEmptyString() + @"boats\onePersonBoat.chr", SCALE);
     nLoc.Y  = permanentYLocation;
     physics = new PhysicsHandler(new AxisAlignedBoundingBox(new Vector3(-1, 0, -1) + nLoc, new Vector3(1f, .1f, 1f) + nLoc));
     faction = Faction.neutral;
 }
Example #3
0
 public override void draw(GraphicsDevice device, Effect effect, DisplayParameters parameters)
 {
     foreach (BlockLoc test in plantBlocks.Keys)
     {
         string number = plantBlocks[test].getGrowthLevel() + "";
         WorldMarkupHandler.addFlagPathWithPosition(ContentDistributor.getEmptyString() + @"worldMarkup\wheatGrowthStage" + number + ".chr",
                                                    test.toWorldSpaceVector3() + new Vector3(.5f, -.5f, .5f));
     }
 }
Example #4
0
        public DecorativePlant(BlockLoc FootLocation)
        {
            blockRootedIn = FootLocation;
            float  height = 5;
            Random rand   = new Random();

            string[] possiblePlants = { "yellowFlower", "blueFlower", "shortLeafyPlant", "bush" };
            string   plantName      = possiblePlants[rand.Next(possiblePlants.Length)];

            setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3() + new Vector3(0, 1, 0), FootLocation.toWorldSpaceVector3() + new Vector3(0, 1, 0) + new Vector3(1f, height, 1f)),
                          ContentDistributor.getEmptyString() + @"world_decoration\" + plantName + ".chr");

            setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f)));
        }
Example #5
0
        public void HandleBlockPlanPlacementMouseover(Ray ray)
        {
            Island  island     = islandManager.getClosestIslandToLocation(ray.Position);
            Vector3?maybeSpace = island.getLastSpaceAlongRayConsideringBuildSite(ray);

            if (maybeSpace.HasValue)
            {
                Vector3 space = (Vector3)maybeSpace;
                space.X = (int)space.X;
                space.Y = (int)space.Y;
                space.Z = (int)space.Z;
                WorldMarkupHandler.addCharacter(ContentDistributor.getEmptyString() + @"worldMarkup\" + "stoneMarkerOutline" + ".chr",
                                                ((Vector3)space) + new Vector3(.5f, .5f, .5f), 1.0f / 12.0f, .6f);
            }
        }
Example #6
0
        public override void draw(GraphicsDevice device, Effect effect, DisplayParameters parameters)
        {
            AnimatedBodyPartGroup block = new AnimatedBodyPartGroup(ContentDistributor.getEmptyString() + @"worldMarkup\" + markerName + ".chr", 1.0f / 7.0f);

            block.setScale(1f / 12f);
            foreach (BlockLoc test in blocksToBuild.Keys)
            {
                //WorldMarkupHandler.addCharacter(ContentDistributor.getEmptyString()+@"worldMarkup\"+markerName+".chr",
                //                           test.toWorldSpaceVector3() + new Vector3(.5f, .5f, .5f), 1.0f/12.0f,.6f);
                block.setRootPartLocation(test.toWorldSpaceVector3() + new Vector3(.5f, .5f, .5f));
                effect.Parameters["xOpacity"].SetValue(.7f);
                effect.Parameters["xTint"].SetValue(ColorPallete.getColorFromByte(blocksToBuild[test]).ToVector4() * 1.2f);
                block.draw(device, effect);
                effect.Parameters["xTint"].SetValue(Color.White.ToVector4());
                effect.Parameters["xOpacity"].SetValue(1f);
            }
        }
Example #7
0
        public static string getPathForResourceType(ResourceType type)
        {
            switch (type)
            {
            case ResourceType.standardBlock:
                return(ContentDistributor.getEmptyString() + @"resources\standardBlock.chr");

            case ResourceType.Wheat:
                return(ContentDistributor.getEmptyString() + @"resources\wheatBale.chr");

            case ResourceType.Wood:
                return(ContentDistributor.getEmptyString() + @"resources\log.chr");

            default:
                throw new Exception("unhandled resource type");
            }
        }
Example #8
0
 public Character(AxisAlignedBoundingBox nAABB, Faction nFaction)
 {
     load    = new CharacterLoad();
     job     = new UnemployedJob();
     physics = new PhysicsHandler(nAABB);
     faction = nFaction;
     if (faction == Faction.friendly)
     {
         bodyType = BodyType.Minotuar;
         switchBodies(ContentDistributor.getEmptyString() + "minotuar.chr");
     }
     else
     {
         bodyType = BodyType.Ghoul;
         switchBodies(ContentDistributor.getEmptyString() + @"ghoul\ghoul.chr");
         walkSpeedWhilePathing *= .9f;
     }
 }
Example #9
0
        void setupBodyPartGroupGivenCurrentJob()
        {
            switch (bodyType)
            {
            case BodyType.Ghoul:
                switchBodies(ContentDistributor.getEmptyString() + @"ghoul\ghoul.chr");
                break;

            case BodyType.Minotuar:
                switch (currentJobType)
                {
                case JobType.combat:
                    switchBodies(ContentDistributor.getEmptyString() + "armedMinotuar.chr");
                    break;

                case JobType.agriculture:
                    switchBodies(ContentDistributor.getEmptyString() + "farmMinotuar.chr");
                    break;

                case JobType.mining:
                    switchBodies(ContentDistributor.getEmptyString() + "mineMinotuar.chr");
                    break;

                case JobType.building:
                    switchBodies(ContentDistributor.getEmptyString() + "buildMinotuar.chr");
                    break;

                case JobType.logging:
                    switchBodies(ContentDistributor.getEmptyString() + "axeMinotuar.chr");
                    break;

                case JobType.CarryingSomething:
                    handleBodyPartChangeForCarryingItem();
                    break;


                default:
                    //switchBodies(ContentDistributor.getEmptyString() + "minotuar.chr");
                    break;
                }
                break;
            }
        }
Example #10
0
        private void handleBodyPartChangeForCarryingItem()
        {
            if (load.isCaryingItem())
            {
                switch (load.getLoad())
                {
                case ResourceBlock.ResourceType.standardBlock:
                    switchBodies(ContentDistributor.getEmptyString() + "carryingStandardBlockMinotuar.chr");
                    break;

                case ResourceBlock.ResourceType.Wheat:
                    switchBodies(ContentDistributor.getEmptyString() + "carryingWheatMinotuar.chr");
                    break;

                case ResourceBlock.ResourceType.Wood:
                    switchBodies(ContentDistributor.getEmptyString() + "carryingLogMinotuar.chr");
                    break;
                }
            }
        }
Example #11
0
        public void draw(GraphicsDevice device, Effect effect, DisplayParameters parameters)
        {
            string path = @"worldMarkup\farmMarker.chr";

            path = ResourceBlock.getPathForResourceType(typeToStore);
            AnimatedBodyPartGroup character = new AnimatedBodyPartGroup(ContentDistributor.getEmptyString() + path, 1.0f / 7.0f);
            float opacity = .2f;

            if (!parameters.hasParameter(DisplayParameter.drawStockpiles))
            {
                opacity = .1f;
            }

            //forward rendering is faster here
            effect.Parameters["xOpacity"].SetValue(opacity);
            character.setScale(1f / 7f);
            foreach (BlockLoc test in storageSpace)
            {
                character.setRootPartLocation(test.toWorldSpaceVector3() + new Vector3(.5f, .5f, .5f));
                character.draw(device, effect);
            }
            effect.Parameters["xOpacity"].SetValue(1);
        }
Example #12
0
        public Tree(BlockLoc nFootLocation, treeTypes type)
        {
            FootLocation = nFootLocation;
            Random rand   = new Random();
            float  height = 5;

            switch (type)
            {
            case treeTypes.maple:
                height = 5;
                string[] possibleTrees = { "tree1", "tree2" };
                string   treeName      = possibleTrees[rand.Next(possibleTrees.Length)];//"fallTree1";
                setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3(), FootLocation.toWorldSpaceVector3() + new Vector3(1f, height, 1f)),
                              ContentDistributor.getEmptyString() + @"trees\" + treeName + ".chr", .8f + (float)new Random().NextDouble() * .4f);
                setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f)));
                break;

            case treeTypes.poplar:
                height = 5;

                string[] poplarNames = { "tree", "tree2", "tree3" };
                string   poplarName  = poplarNames[rand.Next(poplarNames.Length)]; //"fallTree1";
                setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3(), FootLocation.toWorldSpaceVector3() + new Vector3(1f, height, 1f)),
                              ContentDistributor.getEmptyString() + @"poplarTree\" + poplarName + ".chr", .2f);
                setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f)));
                break;

            case treeTypes.pine:
                height = 5;

                string[] pineNames = { "tree" };
                string   pineName  = pineNames[rand.Next(pineNames.Length)]; //"fallTree1";
                String   path      = ContentDistributor.getEmptyString() + @"pineTree\" + pineName + ".chr";
                setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3(), FootLocation.toWorldSpaceVector3() + new Vector3(1f, height, 1f)),
                              path, .4f + (float)rand.NextDouble() * .3f);
                setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f)));
                break;

            case treeTypes.redwood:
                height = 5;

                string[] redwoodNames = { "tree" };
                string   redwoodName  = redwoodNames[rand.Next(redwoodNames.Length)]; //"fallTree1";
                setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3(), FootLocation.toWorldSpaceVector3() + new Vector3(1f, height, 1f)),
                              ContentDistributor.getEmptyString() + @"redwood\" + redwoodName + ".chr", .2f);
                setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f)));
                break;

            case treeTypes.snowyPine:
                height = 5;

                string[] snowPineTreeNames = { "snowyPineTree" };
                string   snowPineTreeName  = snowPineTreeNames[rand.Next(snowPineTreeNames.Length)]; //"fallTree1";
                String   snowPinePath      = ContentDistributor.getEmptyString() + @"pineTree\" + snowPineTreeName + ".chr";
                setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3(), FootLocation.toWorldSpaceVector3() + new Vector3(1f, height, 1f)),
                              snowPinePath, .2f + (float)rand.NextDouble() * .2f);
                setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f)));
                break;

            case treeTypes.snowyLargePine:
                height = 5;

                string[] snowLargePineTreeNames = { "snowyDiskBasedPineTree" };
                string   snowyLargePineTreeName = snowLargePineTreeNames[rand.Next(snowLargePineTreeNames.Length)];  //"fallTree1";
                String   snowyLargePinePath     = ContentDistributor.getEmptyString() + @"pineTree\" + snowyLargePineTreeName + ".chr";
                setupSetPiece(new AxisAlignedBoundingBox(FootLocation.toWorldSpaceVector3(), FootLocation.toWorldSpaceVector3() + new Vector3(1f, height, 1f)),
                              snowyLargePinePath, .5f + (float)rand.NextDouble() * .3f);
                setRootPartRotationOffset(Quaternion.CreateFromRotationMatrix(Matrix.CreateRotationY((float)new Random().NextDouble() * 10.0f)));
                break;

            default:
                break;
            }
        }
Example #13
0
 public override void draw(GraphicsDevice device, Effect effect, DisplayParameters parameters)
 {
     WorldMarkupHandler.addCharacter(ContentDistributor.getEmptyString() + @"boats\greenOnePersonBoat.chr",
                                     objectLoc.toWorldSpaceVector3() + new Vector3(.5f, 0, .5f),
                                     IslandGame.GameWorld.Boat.SCALE, .5f);
 }