コード例 #1
0
        public void GetBeauty()
        {
            CachedBeauty = 0f;

            if (state == State.Closed || ElifsDecorationsSettings.BeautyEnabled)
            {
                return;
            }

            var things = new List <Thing>();

            foreach (var cell in WindowUtility.GetWindowCells(Parent, true).Except(Parent.Cells))
            {
                CachedBeauty += BeautyUtility.CellBeauty(cell, Parent.Map, things);
            }


            CachedBeauty *= .9f;
        }
コード例 #2
0
        // in short, get all the cells in the 'radius' of the window, whichever 'side' of the window has less roof cells becomes the side that is being faced, i.e. light goes to the side with more roofs
        public List <IntVec3> TryResolveFacing()
        {
            var cells = WindowUtility.GetWindowCells(Parent, true);

            int count     = 0;
            int leftCount = 0;
            var map       = Parent.Map;

            foreach (var c in cells)
            {
                if (Parent.Rotation.IsHorizontal)
                {
                    if (c.x > Parent.Position.x)
                    {
                        if (c.Roofed(map))
                        {
                            leftCount++;
                        }
                        else
                        if (c.Roofed(map))
                        {
                            count++;
                        }
                    }
                }
                else
                {
                    if (c.z > Parent.Position.z)
                    {
                        if (c.Roofed(map))
                        {
                            leftCount++;
                        }
                        else
                        if (c.Roofed(map))
                        {
                            count++;
                        }
                    }
                }
            }

            if (count > leftCount)
            {
                if (Parent.Rotation.IsHorizontal)
                {
                    facing = LinkDirections.Left;
                }
                else
                {
                    facing = LinkDirections.Down;
                }
            }
            else if (count < leftCount)
            {
                if (Parent.Rotation.IsHorizontal)
                {
                    facing = LinkDirections.Right;
                }
                else
                {
                    facing = LinkDirections.Up;
                }
            }
            else
            {
                facing = LinkDirections.None;
            }

            return(cells);
        }