private void EnableHidingItem(Material item, float startTime, ShaftAimingMapWorkingNode weapon)
        {
            Vector3 barrelOriginWorld = new MuzzleVisualAccessor(weapon.muzzlePoint).GetBarrelOriginWorld();
            ShaftAimingMapEffectComponent shaftAimingMapEffect = weapon.shaftAimingMapEffect;
            float   initialEnergy = weapon.shaftAimingWorkingState.InitialEnergy;
            float   maxRadius     = shaftAimingMapEffect.ShrubsHidingRadiusMax * initialEnergy;
            Vector4 hidingCenter  = new Vector4(barrelOriginWorld.x, barrelOriginWorld.y, barrelOriginWorld.z, 0f);

            this.EnableMaterialHiding(item, hidingCenter, weapon.shaftEnergy.UnloadAimingEnergyPerSec, maxRadius, Mathf.Lerp(shaftAimingMapEffect.ShrubsHidingRadiusMin, maxRadius, weapon.shaftAimingWorkingState.ExhaustedEnergy / initialEnergy), startTime);
        }
        public void StartHiding(NodeAddedEvent evt, ShaftAimingMapWorkingNode weapon, [JoinByBattle] ICollection <BonusBoxNode> bonuses, [JoinAll] ICollection <BonusRegionNode> regions, ShaftAimingMapWorkingNode weaponToJoinParachutes, [JoinByBattle] ICollection <BonusParachuteNode> parachutes, ShaftAimingMapWorkingNode weaponToJoinFlags, [JoinByBattle] ICollection <FlagNode> flags, [JoinAll] ICollection <SingleNode <MapHidingGeometryComponent> > hidingGeometryCollection)
        {
            float timeSinceLevelLoad = Time.timeSinceLevelLoad;

            foreach (BonusBoxNode node in bonuses)
            {
                this.EnableHidingItem(node.material.Material, timeSinceLevelLoad, weapon);
            }
            foreach (BonusRegionNode node2 in regions)
            {
                this.EnableHidingItem(node2.material.Material, timeSinceLevelLoad, weapon);
            }
            foreach (BonusParachuteNode node3 in parachutes)
            {
                this.EnableHidingItem(node3.parachuteMaterial.Material, timeSinceLevelLoad, weapon);
            }
            foreach (FlagNode node4 in flags)
            {
                this.EnableHidingItem(node4.flagInstance.FlagInstance.GetComponent <Sprite3D>().material, timeSinceLevelLoad, weapon);
            }
            ShaftAimingMapEffectComponent shaftAimingMapEffect = weapon.shaftAimingMapEffect;

            foreach (SingleNode <MapHidingGeometryComponent> node5 in hidingGeometryCollection)
            {
                Renderer[] hidingRenderers = node5.component.hidingRenderers;
                int        index           = 0;
                while (index < hidingRenderers.Length)
                {
                    Renderer renderer = hidingRenderers[index];
                    renderer.receiveShadows = false;
                    Material[] materials = renderer.materials;
                    int        num3      = 0;
                    while (true)
                    {
                        if (num3 >= materials.Length)
                        {
                            index++;
                            break;
                        }
                        Material material = materials[num3];
                        if (material.shader == shaftAimingMapEffect.DefaultLeavesShader)
                        {
                            this.EnableHidingItem(material, weapon, shaftAimingMapEffect.HidingLeavesShader, 0xdac, timeSinceLevelLoad);
                        }
                        else if (material.shader == shaftAimingMapEffect.DefaultBillboardTreesShader)
                        {
                            this.EnableHidingItem(material, weapon, shaftAimingMapEffect.HidingBillboardTreesShader, timeSinceLevelLoad);
                        }
                        num3++;
                    }
                }
            }
        }
        public void StopHiding(NodeAddedEvent evt, AimingMapIdleNode weapon, [JoinByBattle] ICollection <BonusBoxNode> bonuses, [JoinAll] ICollection <BonusRegionNode> regions, AimingMapIdleNode weaponToJoinParachutes, [JoinByBattle] ICollection <BonusParachuteNode> parachutes, AimingMapIdleNode weaponToJoinFlags, [JoinByBattle] ICollection <FlagNode> flags, [JoinAll] ICollection <SingleNode <MapHidingGeometryComponent> > hidingGeometryCollection)
        {
            foreach (BonusBoxNode node in bonuses)
            {
                this.DisableMaterialHiding(node.material.Material);
            }
            foreach (BonusRegionNode node2 in regions)
            {
                this.DisableMaterialHiding(node2.material.Material, 0xc1c);
            }
            foreach (BonusParachuteNode node3 in parachutes)
            {
                this.DisableMaterialHiding(node3.parachuteMaterial.Material);
            }
            foreach (FlagNode node4 in flags)
            {
                this.DisableMaterialHiding(node4.flagInstance.FlagInstance.GetComponent <Sprite3D>().material);
            }
            ShaftAimingMapEffectComponent shaftAimingMapEffect = weapon.shaftAimingMapEffect;

            foreach (SingleNode <MapHidingGeometryComponent> node5 in hidingGeometryCollection)
            {
                Renderer[] hidingRenderers = node5.component.hidingRenderers;
                int        index           = 0;
                while (index < hidingRenderers.Length)
                {
                    Renderer renderer = hidingRenderers[index];
                    renderer.receiveShadows = true;
                    Material[] materials = renderer.materials;
                    int        num2      = 0;
                    while (true)
                    {
                        if (num2 >= materials.Length)
                        {
                            index++;
                            break;
                        }
                        Material material = materials[num2];
                        if (material.shader == shaftAimingMapEffect.HidingLeavesShader)
                        {
                            this.DisableMaterialHiding(material, shaftAimingMapEffect.DefaultLeavesShader, -1);
                        }
                        else if (material.shader == shaftAimingMapEffect.HidingBillboardTreesShader)
                        {
                            this.DisableMaterialHiding(material, shaftAimingMapEffect.DefaultBillboardTreesShader);
                        }
                        num2++;
                    }
                }
            }
        }