示例#1
0
        public override void CreateCosmeticChildren(ComponentManager Manager)
        {
            base.CreateCosmeticChildren(Manager);

            var spriteSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bedtex);

            AddChild(new Box(Manager,
                             "bedbox",
                             Matrix.CreateTranslation(-0.40f, 0.00f, -0.45f) * Matrix.CreateRotationY((float)Math.PI * 0.5f),
                             new Vector3(1.0f, 1.0f, 2.0f),
                             new Vector3(0.0f, 0.0f, 0.0f),
                             "bed",
                             spriteSheet)).SetFlag(Flag.ShouldSerialize, false);

            AddChild(new NewVoxelListener(Manager,
                                          Matrix.Identity,
                                          new Vector3(1.5f, 0.5f, 0.75f), // Position just below surface.
                                          new Vector3(0.5f, -0.30f, 0.0f),
                                          (v) =>
            {
                if (v.Type == VoxelChangeEventType.VoxelTypeChanged &&
                    v.NewVoxelType == 0)
                {
                    Die();
                }
            }))
            .SetFlag(Flag.ShouldSerialize, false)
            .SetFlag(Flag.RotateBoundingBox, true);
        }
示例#2
0
        public static Body CreateBalloon(Vector3 target, Vector3 position, ComponentManager componentManager, ContentManager content, GraphicsDevice graphics, ShipmentOrder order, Faction master)
        {
            Body balloon = new Body("Balloon", componentManager.RootComponent,
                                    Matrix.CreateTranslation(position), new Vector3(0.5f, 1, 0.5f), new Vector3(0, -2, 0));

            SpriteSheet  tex    = new SpriteSheet(ContentPaths.Entities.Balloon.Sprites.balloon);
            List <Point> points = new List <Point>
            {
                new Point(0, 0)
            };
            Animation balloonAnimation = new Animation(graphics, new SpriteSheet(ContentPaths.Entities.Balloon.Sprites.balloon), "balloon", points, false, Color.White, 0.001f, false);
            Sprite    sprite           = new Sprite(componentManager, "sprite", balloon, Matrix.Identity, tex, false)
            {
                OrientationType = Sprite.OrientMode.Spherical
            };

            sprite.AddAnimation(balloonAnimation);

            Matrix    shadowTransform = Matrix.CreateRotationX((float)Math.PI * 0.5f);
            Shadow    shadow          = new Shadow(componentManager, "shadow", balloon, shadowTransform, new SpriteSheet(ContentPaths.Effects.shadowcircle));
            BalloonAI balloonAI       = new BalloonAI(balloon, target, order, master);

            MinimapIcon minimapIcon = new MinimapIcon(balloon, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.map_icons), 16, 2, 0));

            return(balloon);
        }
示例#3
0
        public PlaceBlockSpell(WorldManager world, string voxelType, bool transmute) :
            base(world)
        {
            Texture2D icons = TextureManager.GetTexture(ContentPaths.GUI.icons);

            Image     = new ImageFrame(icons, 32, 1, 2);
            VoxelType = voxelType;
            Transmute = transmute;
            if (!transmute)
            {
                Name          = VoxelType + " Wall";
                Description   = "Create a wall of " + VoxelType;
                Hint          = "Click and drag to place " + VoxelType;
                Recharges     = false;
                RechargeTimer = new Timer(5.0f, false);
                ManaCost      = 15;
                TileRef       = 17;
                Mode          = SpellMode.SelectEmptyVoxels;
            }
            else
            {
                Name          = "Transmute " + VoxelType;
                Description   = "Transmute any block into " + VoxelType;
                Hint          = "Click and drag to transmute.";
                Recharges     = false;
                RechargeTimer = new Timer(5.0f, false);
                ManaCost      = 25;
                TileRef       = 18;
                Mode          = SpellMode.SelectFilledVoxels;
            }
        }
示例#4
0
        public InspectSpell(InspectType type)
        {
            Type = type;
            Texture2D icons = TextureManager.GetTexture(ContentPaths.GUI.icons);

            Recharges = false;
            switch (type)
            {
            case InspectType.InspectBlock:
            {
                Image         = new ImageFrame(icons, 32, 7, 1);
                ManaCost      = 0;
                Mode          = Spell.SpellMode.SelectFilledVoxels;
                Name          = "Inspect Blocks";
                Description   = "Mouse over a block to get info about it";
                Hint          = "Mouse over a block for info";
                RechargeTimer = new Timer(0.1f, true);
                break;
            }

            case InspectType.InspectEntity:
            {
                Image         = new ImageFrame(icons, 32, 7, 1);
                ManaCost      = 0;
                Mode          = Spell.SpellMode.Continuous;
                Name          = "Inspect Objects";
                Description   = "Select an entity to get info about it";
                Hint          = "Mouse over entities for info";
                RechargeTimer = new Timer(0.1f, true);
                break;
            }
            }
        }
示例#5
0
        /// <summary>
        /// Creates a generic particle effect which is like a "puff" (cloudy particles which float)
        /// </summary>
        public static EmitterData CreatePuffLike(string name, SpriteSheet sheet, Point frame, BlendState state)
        {
            Texture2D   tex  = TextureManager.GetTexture(sheet.AssetName);
            EmitterData data = new EmitterData
            {
                Animation = new Animation(GameState.Game.GraphicsDevice, sheet, name, sheet.FrameWidth, sheet.FrameHeight, new List <Point>()
                {
                    frame
                }, true, Color.White, 1.0f, 1.0f, 1.0f, false),
                ConstantAccel     = new Vector3(0, 3, 0),
                LinearDamping     = 0.9f,
                AngularDamping    = 0.99f,
                EmissionFrequency = 20.0f,
                EmissionRadius    = 1.0f,
                EmissionSpeed     = 2.0f,
                GrowthSpeed       = -0.6f,
                MaxAngle          = 3.14159f,
                MinAngle          = 0.0f,
                MaxParticles      = 1000,
                MaxScale          = 1.0f,
                MinScale          = 0.1f,
                MinAngular        = -5.0f,
                MaxAngular        = 5.0f,
                ParticleDecay     = 0.8f,
                ParticlesPerFrame = 0,
                ReleaseOnce       = true,
                Texture           = TextureManager.GetTexture(sheet.AssetName),
                Blend             = state
            };

            return(data);
        }
示例#6
0
        public static RoomData InitializeData()
        {
            Dictionary <Resource.ResourceTags, Quantitiy <Resource.ResourceTags> > roomResources = new Dictionary <Resource.ResourceTags, Quantitiy <Resource.ResourceTags> >()
            {
                { Resource.ResourceTags.Metal, new Quantitiy <Resource.ResourceTags>(Resource.ResourceTags.Metal) },
                { Resource.ResourceTags.Fuel, new Quantitiy <Resource.ResourceTags>(Resource.ResourceTags.Fuel) },
            };

            List <RoomTemplate> workshopTemplates = new List <RoomTemplate>();

            RoomTile[,] anvilTemp =
            {
                {
                    RoomTile.Open,
                    RoomTile.Open,
                    RoomTile.Open
                },
                {
                    RoomTile.Open,
                    RoomTile.Forge,
                    RoomTile.Open
                },
                {
                    RoomTile.Open,
                    RoomTile.Open,
                    RoomTile.Open
                }
            };

            RoomTile[,] anvilAcc =
            {
                {
                    RoomTile.None,
                    RoomTile.None,
                    RoomTile.None
                },
                {
                    RoomTile.None,
                    RoomTile.None,
                    RoomTile.None
                },
                {
                    RoomTile.None,
                    RoomTile.Anvil,
                    RoomTile.None
                }
            };

            RoomTemplate anvil = new RoomTemplate(PlacementType.All, anvilTemp, anvilAcc);

            workshopTemplates.Add(anvil);

            Texture2D roomIcons = TextureManager.GetTexture(ContentPaths.GUI.room_icons);

            return(new RoomData(WorkshopName, 2, "CobblestoneFloor", roomResources, workshopTemplates, new ImageFrame(roomIcons, 16, 1, 1))
            {
                Description = "Craftsdwarves build mechanisms here",
                CanBuildAboveGround = false
            });
        }
示例#7
0
        public DwarfGUI(DwarfGame game, SpriteFont defaultFont, SpriteFont titleFont, SpriteFont smallFont, InputManager input)
        {
            IndicatorManager.DefaultFont = defaultFont;
            EnableMouseEvents            = true;
            IsMouseVisible = true;
            MouseMode      = GUISkin.MousePointer.Pointer;
            SmallFont      = smallFont;
            Graphics       = game.GraphicsDevice;
            this.game      = game;
            RootComponent  = new GUIComponent(this, null)
            {
                LocalBounds = new Rectangle(0, 0, 0, 0)
            };

            DefaultFont = defaultFont;
            Skin        = new GUISkin(TextureManager.GetTexture(ContentPaths.GUI.gui_widgets), 32, 32, TextureManager.GetTexture(ContentPaths.GUI.pointers), 16, 16);
            Skin.SetDefaults();
            TitleFont          = titleFont;
            GlobalOffset       = Vector2.Zero;
            FocusComponent     = null;
            Input              = input;
            DrawAfter          = new List <GUIComponent>();
            DefaultTextColor   = new Color(48, 27, 0);
            DefaultStrokeColor = Color.Transparent;
            DebugDraw          = false;
            ToolTipManager     = new ToolTipManager(this);
            LastScrollWheel    = 0;
            LastMouseX         = 0;
            LastMouseY         = 0;
        }
示例#8
0
        /// <summary>
        /// A library function which creates a "explosion" particle effect (bouncy particles)
        /// </summary>
        /// <param name="assetName">Particle texture name</param>
        /// <param name="name">Name of the effect</param>
        /// <returns>A particle emitter which behaves like an explosion.</returns>
        public ParticleEffect CreateGenericExplosion(string assetName, string name)
        {
            List <Point> frm = new List <Point>
            {
                new Point(0, 0)
            };
            Texture2D   tex      = TextureManager.GetTexture(assetName);
            EmitterData testData = new EmitterData
            {
                Animation         = new Animation(GameState.Game.GraphicsDevice, new SpriteSheet(assetName), assetName, tex.Width, tex.Height, frm, true, Color.White, 1.0f, 1.0f, 1.0f, false),
                ConstantAccel     = new Vector3(0, -10, 0),
                LinearDamping     = 0.9999f,
                AngularDamping    = 0.9f,
                EmissionFrequency = 50.0f,
                EmissionRadius    = 1.0f,
                EmissionSpeed     = 5.0f,
                GrowthSpeed       = -0.0f,
                MaxAngle          = 3.14159f,
                MinAngle          = 0.0f,
                MaxParticles      = 1000,
                MaxScale          = 0.2f,
                MinScale          = 0.1f,
                MinAngular        = -5.0f,
                MaxAngular        = 5.0f,
                ParticleDecay     = 0.5f,
                ParticlesPerFrame = 0,
                ReleaseOnce       = true,
                Texture           = tex,
                CollidesWorld     = true,
                Sleeps            = true
            };

            RegisterEffect(name, testData);
            return(Effects[name]);
        }
示例#9
0
 public CreateEntitySpell(string entity, bool transmute)
 {
     Entity    = entity;
     Transmute = transmute;
     ManaCost  = 50;
     Mode      = transmute ? SpellMode.SelectEntities : SpellMode.SelectEmptyVoxels;
     Image     = new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.icons), 32, 4, 2);
 }
示例#10
0
        public NamedImageFrame(string name)
        {
            AssetName = name;
            Image     = TextureManager.GetTexture(name);

            if (Image != null)
            {
                SourceRect = Image.Bounds;
            }
        }
示例#11
0
        public SpriteSheet(string name, int frameSize)
        {
            FrameWidth  = frameSize;
            FrameHeight = frameSize;
            AssetName   = name;
            Texture2D tex = TextureManager.GetTexture(name);

            Width  = tex.Width;
            Height = tex.Height;
        }
示例#12
0
        public Crate(Vector3 position) :
            base("Crate", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(position), new Vector3(0.75f, 0.5f, 1.5f), new Vector3(0.5f, 0.5f, 1.0f))
        {
            Texture2D spriteSheet = TextureManager.GetTexture(ContentPaths.Terrain.terrain_tiles);

            Box crateModel = new Box(PlayState.ComponentManager, "Cratebox", this, Matrix.CreateRotationY(MathFunctions.Rand(-0.25f, 0.25f)), new Vector3(1.0f, 1.0f, 1.0f), new Vector3(0.5f, 0.5f, 0.5f), "crate", spriteSheet);

            Tags.Add("Crate");
            CollisionType = CollisionManager.CollisionType.Static;
        }
示例#13
0
        public SpriteSheet(string name)
        {
            AssetName = name;
            Texture2D tex = TextureManager.GetTexture(name);

            FrameWidth  = tex.Width;
            FrameHeight = tex.Height;
            Width       = tex.Width;
            Height      = tex.Height;
        }
示例#14
0
        public Tree(Vector3 position, string asset, float treeSize) :
            base("Tree", PlayState.ComponentManager.RootComponent, Matrix.Identity, new Vector3(treeSize * 2, treeSize * 3, treeSize * 2), new Vector3(treeSize * 0.5f, treeSize * 0.25f, treeSize * 0.5f))
        {
            Seedlingsheet = new SpriteSheet(ContentPaths.Entities.Plants.vine, 32, 32);
            SeedlingFrame = new Point(0, 0);
            HurtTimer     = new Timer(1.0f, false);
            ComponentManager componentManager = PlayState.ComponentManager;
            Matrix           matrix           = Matrix.Identity;

            matrix.Translation = position;
            LocalTransform     = matrix;

            new Mesh(componentManager, "Model", this, Matrix.CreateRotationY((float)(PlayState.Random.NextDouble() * Math.PI)) * Matrix.CreateScale(treeSize, treeSize, treeSize) * Matrix.CreateTranslation(new Vector3(0.7f, 0.0f, 0.7f)), asset, false);

            Health health = new Health(componentManager, "HP", this, 100.0f * treeSize, 0.0f, 100.0f * treeSize);

            new Flammable(componentManager, "Flames", this, health);


            Tags.Add("Vegetation");
            Tags.Add("EmitsWood");

            new MinimapIcon(this, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.map_icons), 16, 1, 0));
            Voxel voxelUnder = new Voxel();

            if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder))
            {
                new VoxelListener(componentManager, this, PlayState.ChunkManager, voxelUnder);
            }

            Inventory inventory = new Inventory("Inventory", this)
            {
                Resources = new ResourceContainer
                {
                    MaxResources = (int)(treeSize * 10)
                }
            };

            inventory.Resources.AddResource(new ResourceAmount()
            {
                NumResources = (int)(treeSize * 10),
                ResourceType = ResourceLibrary.Resources[ResourceLibrary.ResourceType.Wood]
            });


            Particles = new ParticleTrigger("Leaves", componentManager, "LeafEmitter", this,
                                            Matrix.Identity, new Vector3(treeSize * 2, treeSize * 3, treeSize * 2), new Vector3(treeSize * 0.5f, treeSize * 0.25f, treeSize * 0.5f))
            {
                SoundToPlay = ContentPaths.Audio.vegetation_break
            };


            AddToCollisionManager = true;
            CollisionType         = CollisionManager.CollisionType.Static;
        }
示例#15
0
        public WaterRenderer(GraphicsDevice device)
        {
            PresentationParameters pp = device.PresentationParameters;

            int width  = Math.Min(pp.BackBufferWidth / 4, 4096);
            int height = Math.Min(pp.BackBufferHeight / 4, 4096);

            ReflectionMap          = new Texture2D(device, width, height);
            reflectionRenderTarget = new RenderTarget2D(device, width, height, false, pp.BackBufferFormat, pp.DepthStencilFormat);
            ShoreMap = TextureManager.GetTexture(ContentPaths.Gradients.shoregradient);
        }
示例#16
0
        public void CreateHitAnimation()
        {
            Texture2D  text   = TextureManager.GetTexture(AnimationAsset);
            List <int> frames = new List <int>();

            for (int i = 0; i < text.Width / text.Height; i++)
            {
                frames.Add(i);
            }
            HitAnimation = new Animation(AnimationAsset, text.Height, text.Height, frames.ToArray());
        }
示例#17
0
 public Texture2D GetTexture()
 {
     if (FixedTexture == null)
     {
         return(TextureManager.GetTexture(AssetName));
     }
     else
     {
         return(FixedTexture);
     }
 }
示例#18
0
        public static RoomData InitializeData()
        {
            List <RoomTemplate> stockpileTemplates = new List <RoomTemplate>();
            Dictionary <ResourceLibrary.ResourceType, ResourceAmount> stockpileResources = new Dictionary <ResourceLibrary.ResourceType, ResourceAmount>();

            Texture2D roomIcons = TextureManager.GetTexture(ContentPaths.GUI.room_icons);

            return(new RoomData(StockpileName, 0, "Stockpile", stockpileResources, stockpileTemplates, new ImageFrame(roomIcons, 16, 0, 0))
            {
                Description = "Dwarves can stock resources here",
            });
        }
示例#19
0
        public DestroyBlockSpell()
        {
            Texture2D icons = TextureManager.GetTexture(ContentPaths.GUI.icons);

            Description = "Magically destroys up to 8 stone, dirt, or other blocks.";
            Image       = new ImageFrame(icons, 32, 2, 2);
            ManaCost    = 10;
            Mode        = Spell.SpellMode.SelectFilledVoxels;
            Name        = "Destroy Blocks";
            Hint        = "Click and drag to destroy blocks";
            Recharges   = false;
        }
示例#20
0
        public static void CreateIntersecting(string name, string assetName, GraphicsDevice graphics, ContentManager content)
        {
            Texture2D     bushSheet      = TextureManager.GetTexture(assetName);
            List <Matrix> bushTransforms = new List <Matrix>();
            List <Color>  bushColors     = new List <Color>();

            bushTransforms.Add(Matrix.Identity);
            bushTransforms.Add(Matrix.CreateRotationY(1.57f));
            bushColors.Add(Color.White);
            bushColors.Add(Color.White);

            BatchBillboardPrimitives[name] = new BatchBillboardPrimitive(graphics, bushSheet, bushSheet.Width, bushSheet.Height, new Point(0, 0), 1.0f, 1.0f, false, bushTransforms, bushColors, bushColors);
        }
示例#21
0
        public override void CreateCosmeticChildren(ComponentManager Manager)
        {
            base.CreateCosmeticChildren(Manager);

            var spriteSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bookshelf);

            AddChild(new Box(Manager,
                             "model",
                             Matrix.CreateTranslation(new Vector3(-20.0f / 64.0f, -32.0f / 64.0f, -8.0f / 64.0f)),
                             new Vector3(32.0f / 32.0f, 8.0f / 32.0f, 20.0f / 32.0f),
                             new Vector3(0.0f, 0.0f, 0.0f),
                             "bookshelf",
                             spriteSheet)).SetFlag(Flag.ShouldSerialize, false);
        }
示例#22
0
        public override void CreateCosmeticChildren(ComponentManager Manager)
        {
            base.CreateCosmeticChildren(Manager);

            var spriteSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bedtex);

            AddChild(new Box(Manager,
                             "bedbox",
                             Matrix.CreateTranslation(-0.5f, -0.5f, -0.5f) * Matrix.CreateRotationY((float)Math.PI * 0.5f),
                             new Vector3(1.0f, 1.0f, 2.0f),
                             new Vector3(0.5f, 0.5f, 1.0f),
                             "bed",
                             spriteSheet)).SetFlag(Flag.ShouldSerialize, false);
        }
示例#23
0
        public override void CreateCosmeticChildren(ComponentManager Manager)
        {
            base.CreateCosmeticChildren(Manager);

            var spriteSheet = TextureManager.GetTexture(ContentPaths.Terrain.terrain_tiles);

            AddChild(new Box(Manager,
                             "Cratebox",
                             Matrix.CreateRotationY(MathFunctions.Rand(-0.25f, 0.25f)),
                             new Vector3(1.0f, 1.0f, 1.0f),
                             new Vector3(0.5f, 0.5f, 0.5f),
                             "crate",
                             spriteSheet)).SetFlag(Flag.ShouldSerialize, false);
        }
示例#24
0
        public static RoomData InitializeData()
        {
            Dictionary <ResourceLibrary.ResourceType, ResourceAmount> balloonPortResources = new Dictionary <ResourceLibrary.ResourceType, ResourceAmount>();
            ResourceAmount balloonStoneRequired = new ResourceAmount
            {
                ResourceType = ResourceLibrary.Resources[ResourceLibrary.ResourceType.Wood],
                NumResources = 1
            };

            balloonPortResources[ResourceLibrary.ResourceType.Wood] = balloonStoneRequired;

            RoomTile[,] flagTemplate =
            {
                {
                    RoomTile.None,
                    RoomTile.Wall | RoomTile.Edge
                },
                {
                    RoomTile.Wall | RoomTile.Edge,
                    RoomTile.Flag
                }
            };

            RoomTile[,] flagAccesories =
            {
                {
                    RoomTile.None,
                    RoomTile.None
                },
                {
                    RoomTile.None,
                    RoomTile.None
                }
            };

            RoomTemplate flag = new RoomTemplate(PlacementType.All, flagTemplate, flagAccesories);


            List <RoomTemplate> balloonTemplates = new List <RoomTemplate>
            {
                flag
            };
            Texture2D roomIcons = TextureManager.GetTexture(ContentPaths.GUI.room_icons);

            return(new RoomData(BalloonPortName, 0, "Stockpile", balloonPortResources, balloonTemplates, new ImageFrame(roomIcons, 16, 1, 0))
            {
                Description = "Balloons pick up / drop off resources here.",
                CanBuildBelowGround = false
            });
        }
示例#25
0
        public DwarfRunner(DwarfGame game)
        {
            WorldSize = new Point((game.GraphicsDevice.Viewport.Width / TileSize.X) + 4, 10);
            World     = new Tile[WorldSize.X, WorldSize.Y];

            String[] sheets =
            {
                ContentPaths.Entities.Dwarf.Sprites.soldier, ContentPaths.Entities.Dwarf.Sprites.worker,
                ContentPaths.Entities.Dwarf.Sprites.crafter, ContentPaths.Entities.Dwarf.Sprites.wizard,
                ContentPaths.Entities.Dwarf.Sprites.musket
            };

            Texture2D tiles = TextureManager.GetTexture(ContentPaths.Terrain.terrain_tiles);

            Balloon = TextureManager.GetTexture(ContentPaths.Entities.Balloon.Sprites.balloon);
            Dwarf   = TextureManager.GetTexture(Datastructures.SelectRandom(sheets));

            Soil  = new ImageFrame(tiles, 32, 2, 0);
            Grass = new ImageFrame(tiles, 32, 3, 0);

            DwarfFrames = new List <ImageFrame>(new ImageFrame[]
            {
                new ImageFrame(Dwarf, new Rectangle(0, 80, 32, 40)),
                new ImageFrame(Dwarf, new Rectangle(32, 80, 32, 40)),
                new ImageFrame(Dwarf, new Rectangle(64, 80, 32, 40)),
                new ImageFrame(Dwarf, new Rectangle(96, 80, 32, 40)),
            });

            UpFrame   = new ImageFrame(Dwarf, new Rectangle(0, 239, 32, 40));
            DownFrame = new ImageFrame(Dwarf, new Rectangle(32, 239, 32, 40));
            for (var x = 0; x < WorldSize.X; ++x)
            {
                World[x, 0] = new Tile
                {
                    Solid = true,
                    Image = Soil
                }
            }
            ;

            for (var x = 0; x < WorldSize.X; ++x)
            {
                World[x, 1] = new Tile
                {
                    Solid = true,
                    Image = Grass
                }
            }
            ;
        }
示例#26
0
        public static Company GenerateRandom(float assets, float stockPrice, Sector industry)
        {
            Texture2D texture = TextureManager.GetTexture(ContentPaths.Logos.logos);

            int row = 0;

            switch (industry)
            {
            case Sector.Magic:
                row = 3;
                break;

            case Sector.Finance:
                row = 3;
                break;

            case Sector.Exploration:
                row = 0;
                break;

            case Sector.Manufacturing:
                row = 1;
                break;

            case Sector.Military:
                row = 2;
                break;
            }
            NamedImageFrame image = new NamedImageFrame(ContentPaths.Logos.logos, 32, PlayState.Random.Next(0, texture.Width / 32), row);

            Color c = new Color(PlayState.Random.Next(0, 255), PlayState.Random.Next(0, 255),
                                PlayState.Random.Next(0, 255));

            return(new Company()
            {
                Assets = assets,
                StockPrice = stockPrice,
                Industry = industry,
                Logo = image,
                Name = GenerateName(industry),
                Motto = GenerateMotto(),
                BaseColor = c,
                SecondaryColor = c,
                StockHistory = GenerateRandomStockHistory(stockPrice, 10),
                LastAssets = assets
            });
        }
示例#27
0
 public Faction()
 {
     Threats            = new List <Creature>();
     Minions            = new List <CreatureAI>();
     SelectedMinions    = new List <CreatureAI>();
     TaskManager        = new TaskManager(this);
     Stockpiles         = new List <Stockpile>();
     DigDesignations    = new List <BuildOrder>();
     GuardDesignations  = new List <BuildOrder>();
     ChopDesignations   = new List <Body>();
     AttackDesignations = new List <Body>();
     ShipDesignations   = new List <ShipOrder>();
     GatherDesignations = new List <Body>();
     RoomBuilder        = new RoomBuilder(this);
     WallBuilder        = new PutDesignator(this, TextureManager.GetTexture(ContentPaths.Terrain.terrain_tiles));
     CraftBuilder       = new CraftBuilder(this);
 }
示例#28
0
        public static void SetupStandards()
        {
            Texture2D indicators = TextureManager.GetTexture(ContentPaths.GUI.indicators);

            StandardFrames[StandardIndicators.Happy]      = new ImageFrame(indicators, 16, 4, 0);
            StandardFrames[StandardIndicators.Hungry]     = new ImageFrame(indicators, 16, 0, 0);
            StandardFrames[StandardIndicators.Sad]        = new ImageFrame(indicators, 16, 5, 0);
            StandardFrames[StandardIndicators.Sleepy]     = new ImageFrame(indicators, 16, 3, 0);
            StandardFrames[StandardIndicators.Question]   = new ImageFrame(indicators, 16, 1, 1);
            StandardFrames[StandardIndicators.Exclaim]    = new ImageFrame(indicators, 16, 0, 1);
            StandardFrames[StandardIndicators.Heart]      = new ImageFrame(indicators, 16, 4, 1);
            StandardFrames[StandardIndicators.Boom]       = new ImageFrame(indicators, 16, 2, 1);
            StandardFrames[StandardIndicators.Dots]       = new ImageFrame(indicators, 16, 3, 1);
            StandardFrames[StandardIndicators.DownArrow]  = new ImageFrame(indicators, 16, 0, 2);
            StandardFrames[StandardIndicators.UpArrow]    = new ImageFrame(indicators, 16, 1, 2);
            StandardFrames[StandardIndicators.LeftArrow]  = new ImageFrame(indicators, 16, 2, 2);
            StandardFrames[StandardIndicators.RightArrow] = new ImageFrame(indicators, 16, 3, 2);
        }
示例#29
0
        // 20 x 8 x 32
        public Bookshelf(Vector3 position) :
            base("Bookshelf", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(position), new Vector3(32.0f / 32.0f, 8.0f / 32.0f, 20.0f / 32.0f), new Vector3(0.5f, 0.5f, 0.5f))
        {
            Texture2D spriteSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bookshelf);

            bedModel = new Box(PlayState.ComponentManager, "model", this, Matrix.CreateTranslation(new Vector3(-20.0f / 64.0f, -32.0f / 64.0f, -8.0f / 64.0f)), new Vector3(32.0f / 32.0f, 8.0f / 32.0f, 20.0f / 32.0f), new Vector3(0.0f, 0.0f, 0.0f), PrimitiveLibrary.BoxPrimitives["bookshelf"], spriteSheet);

            Voxel voxelUnder = new Voxel();


            if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder))
            {
                VoxelListener listener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxelUnder);
            }

            Tags.Add("Books");
            CollisionType = CollisionManager.CollisionType.Static;
        }
示例#30
0
        public Bed(Vector3 position) :
            base("Bed", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(position), new Vector3(1.5f, 0.5f, 0.75f), new Vector3(-0.5f + 1.5f * 0.5f, -0.5f + 0.25f, -0.5f + 0.75f * 0.5f))
        {
            Texture2D spriteSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bedtex);

            bedModel = new Box(PlayState.ComponentManager, "bedbox", this, Matrix.CreateTranslation(-0.5f, -0.5f, -0.5f) * Matrix.CreateRotationY((float)Math.PI * 0.5f), new Vector3(1.0f, 1.0f, 2.0f), new Vector3(0.5f, 0.5f, 1.0f), PrimitiveLibrary.BoxPrimitives["bed"], spriteSheet);

            Voxel voxelUnder = new Voxel();


            if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder))
            {
                VoxelListener listener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxelUnder);
            }

            Tags.Add("Bed");
            CollisionType = CollisionManager.CollisionType.Static;
        }