Beispiel #1
0
        public override byte ClientGetTextureAtlasColumn(
            IStaticWorldObject worldObject,
            VegetationPublicState statePublic)
        {
            var bushPublicState = (ObjectBushPublicState)statePublic;

            if (bushPublicState.HasHarvest)
            {
                // return last column in texture
                return((byte)(this.GrowthStagesCount + 1));
            }

            return(base.ClientGetTextureAtlasColumn(worldObject, statePublic));
        }
Beispiel #2
0
        public override byte ClientGetTextureAtlasColumn(
            IStaticWorldObject worldObject,
            VegetationPublicState publicState)
        {
            var growthStage = publicState.GrowthStage;

            if (growthStage == this.GrowthStagesCount)
            {
                // full grown - select one of two variants based on position
                return((byte)(growthStage
                              + PositionalRandom.Get(worldObject.TilePosition, 0, 2, seed: 90139875u)));
            }

            return(growthStage);
        }
Beispiel #3
0
        protected override double ServerCalculateGrowthStageDuration(
            byte growthStage,
            VegetationPrivateState privateState,
            VegetationPublicState publicState)
        {
            var objectTree = (IStaticWorldObject)privateState.GameObject;
            var duration   = base.ServerCalculateGrowthStageDuration(growthStage, privateState, publicState);

            if (LandClaimSystem.SharedIsObjectInsideAnyArea(objectTree))
            {
                return(duration);
            }

            // x1.5 faster growth when not inside any land claim area as this resource
            // is rare and essential especially for PvP
            return(duration / 1.5);
        }
Beispiel #4
0
        public override byte ClientGetTextureAtlasColumn(
            IStaticWorldObject worldObject,
            VegetationPublicState statePublic)
        {
            var plantPublicState = (TPublicState)statePublic;

            if (plantPublicState.IsSpoiled)
            {
                return((byte)(this.GrowthStageIndexSpoilingProcess + 1));
            }

            if (plantPublicState.HasHarvest)
            {
                return((byte)(this.GrowthStageIndexHarvestProductionProcess + 1));
            }

            return(base.ClientGetTextureAtlasColumn(worldObject, statePublic));
        }
Beispiel #5
0
        protected override void ClientRefreshVegetationRendering(
            IStaticWorldObject worldObject,
            VegetationClientState clientState,
            VegetationPublicState publicState)
        {
            base.ClientRefreshVegetationRendering(worldObject, clientState, publicState);

            if (publicState.GrowthStage > 2 &&
                publicState.GrowthStage < this.GrowthStagesCount)
            {
                ClientGrassRenderingHelper.Setup(clientState.Renderer,
                                                 power: 0.1f,
                                                 pivotY: 0.2f);
            }
            else
            {
                // no grass swaying for the just planted and spoiled plant
                clientState.Renderer.RenderingMaterial = null;
            }
        }