Example #1
0
        protected Resource(string name, int durability, ComponentHarvestable harvestBehavior, bool walkable)
            : base(true)
        {
            this.AddComponent(new ComponentHasTexture(false));
            this.AddComponent(harvestBehavior);

            this.DisplayName   = name;
            this.Durability    = durability;
            this.Walkable      = walkable;
            this.MaxDurability = new Attribute32(this.Durability);
        }
Example #2
0
        public void GetComponent_StateUnderTest_ExpectedBehavior()
        {
            // Arrange
            HasComponents unitUnderTest = this.CreateHasComponents();

            // Act
            ComponentSelectable  result  = unitUnderTest.GetComponent <ComponentSelectable>();
            ComponentHarvestable result2 = unitUnderTest.GetComponent <ComponentHarvestable>();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsNotNull(result2);
        }
Example #3
0
        public Corn(string name, int durability, ComponentHarvestable harvestBehavior)
            : base(Name, durability, harvestBehavior, true)
        {
            // Determine corn yield
            Random random    = new Random();
            int    cornYield = random.Next(MinimumCornYield, MaximumCornYield);

            this.Durability = DefaultCornDurability;

            // initialize harvesting list
            List <Base.Item> list = new List <Base.Item>
            {
                new CornEar(cornYield)
            };

            this.AddComponent(new DropWhenCompletelyHarvested(list, SoundsTable.TreeFall, SoundsTable.TreeFall));

            ComponentHasTexture textureComponent = this.GetExactComponent <ComponentHasTexture>();

            textureComponent.Visuals.Add(CornSeedling);
            textureComponent.Visuals.Add(CornGrowth1);
            textureComponent.Visuals.Add(CornGrowth2);
            textureComponent.Visuals.Add(CornFullGrowth);
        }
Example #4
0
 /// <summary>
 /// The constructor for <see cref="Vegetation"/>.
 /// </summary>
 /// <param name="name">The name of this vegetation.</param>
 protected Vegetation(string name, int durability, ComponentHarvestable harvestBehavior, bool walkable)
     : base(name, durability, harvestBehavior, walkable)
 {
 }
Example #5
0
 protected TreeBase(string name, int durability, ComponentHarvestable harvestBehavior)
     : base(name, durability, harvestBehavior, true)
 {
 }
Example #6
0
 protected RockBase(string name, int durability, ComponentHarvestable harvestBehavior)
     : base(name, durability, harvestBehavior, false)
 {
 }