示例#1
0
        public void AddParticleSystems(int value, int x, int y, int z)
        {
            if (Terrain.ExtractContents(value) != 227)
            {
                return;
            }
            int             data        = Terrain.ExtractData(value);
            int             rotation    = FurnitureBlock.GetRotation(data);
            int             designIndex = FurnitureBlock.GetDesignIndex(data);
            FurnitureDesign design      = GetDesign(designIndex);

            if (design == null)
            {
                return;
            }
            List <FireParticleSystem> list = new List <FireParticleSystem>();

            BoundingBox[] torchPoints = design.GetTorchPoints(rotation);
            if (torchPoints.Length != 0)
            {
                BoundingBox[] array = torchPoints;
                for (int i = 0; i < array.Length; i++)
                {
                    BoundingBox        boundingBox        = array[i];
                    float              num                = (boundingBox.Size().X + boundingBox.Size().Y + boundingBox.Size().Z) / 3f;
                    float              size               = MathUtils.Clamp(1.5f * num, 0.1f, 1f);
                    FireParticleSystem fireParticleSystem = new FireParticleSystem(new Vector3(x, y, z) + boundingBox.Center(), size, 24f);
                    m_subsystemParticles.AddParticleSystem(fireParticleSystem);
                    list.Add(fireParticleSystem);
                }
            }
            if (list.Count > 0)
            {
                m_particleSystemsByCell[new Point3(x, y, z)] = list;
            }
        }
        public static IEnumerable <CellFace> GetMountingCellFaces(SubsystemElectricity subsystemElectricity, Point3 point)
        {
            int             data        = Terrain.ExtractData(subsystemElectricity.SubsystemTerrain.Terrain.GetCellValue(point.X, point.Y, point.Z));
            int             rotation    = FurnitureBlock.GetRotation(data);
            int             designIndex = FurnitureBlock.GetDesignIndex(data);
            FurnitureDesign design      = subsystemElectricity.SubsystemTerrain.SubsystemFurnitureBlockBehavior.GetDesign(designIndex);

            if (design == null)
            {
                yield break;
            }
            int face = 0;

            while (face < 6)
            {
                int num = (face < 4) ? ((face - rotation + 4) % 4) : face;
                if ((design.MountingFacesMask & (1 << num)) != 0)
                {
                    yield return(new CellFace(point.X, point.Y, point.Z, CellFace.OppositeFace(face)));
                }
                int num2 = face + 1;
                face = num2;
            }
        }