Esempio n. 1
0
 public virtual BasePart.GridRotation AutoAlignRotation(BasePart.JointConnectionDirection target)
 {
     if (this.m_jointConnectionDirection == BasePart.JointConnectionDirection.None)
     {
         return(BasePart.RotationTo(this.m_customJointConnectionDirection, target));
     }
     return(BasePart.RotationTo(this.m_jointConnectionDirection, target));
 }
Esempio n. 2
0
    public override BasePart.GridRotation AutoAlignRotation(BasePart.JointConnectionDirection target)
    {
        switch (target)
        {
        case BasePart.JointConnectionDirection.Right:
            return(BasePart.GridRotation.Deg_180);

        case BasePart.JointConnectionDirection.Up:
            return(BasePart.GridRotation.Deg_0);

        case BasePart.JointConnectionDirection.Left:
            return(BasePart.GridRotation.Deg_0);

        case BasePart.JointConnectionDirection.Down:
            return(BasePart.GridRotation.Deg_90);

        default:
            return(BasePart.GridRotation.Deg_0);
        }
    }
Esempio n. 3
0
    private static void CheckSideAndAppendGlue(BasePart partWithGlue, BasePart anotherPart, Direction dir, Type type)
    {
        bool flag      = dir == Glue.Direction.Up || dir == Glue.Direction.Down;
        bool flag2     = dir == Glue.Direction.Left || dir == Glue.Direction.Right;
        Glue component = partWithGlue.GetComponent <Glue>();

        if (anotherPart != null)
        {
            Glue component2 = anotherPart.GetComponent <Glue>();
            BasePart.JointConnectionDirection jointConnectionDirection = anotherPart.GetJointConnectionDirection();
            bool flag3 = BasePart.IsDirection(jointConnectionDirection);
            bool flag4 = (flag3 && Glue.OppositeGlueDir(BasePart.ConvertDirection(jointConnectionDirection)) == dir) || (flag && jointConnectionDirection == BasePart.JointConnectionDirection.UpAndDown) || (flag2 && jointConnectionDirection == BasePart.JointConnectionDirection.LeftAndRight) || (jointConnectionDirection == BasePart.JointConnectionDirection.Any && anotherPart.GetJointConnectionType() != BasePart.JointConnectionType.None);
            if ((component.m_GlueDirectionMask & (int)dir) == 0)
            {
                if (component2)
                {
                    if ((component2.m_GlueDirectionMask & (int)Glue.OppositeGlueDir(dir)) == 0)
                    {
                        Glue.AddSuperGlueSprite(component, dir, type);
                    }
                }
                else if (Glue.IsPartTypeRequireGlue(anotherPart.m_partType) || flag4)
                {
                    Glue.AddSuperGlueSprite(component, dir, type);
                }
                else
                {
                    Glue.RemoveSuperGlueSprite(component, dir);
                }
            }
            else if (!Glue.IsPartTypeRequireGlue(anotherPart.m_partType) && !flag4)
            {
                Glue.RemoveSuperGlueSprite(component, dir);
            }
        }
        else if (!anotherPart && (component.m_GlueDirectionMask & (int)dir) != 0)
        {
            Glue.RemoveSuperGlueSprite(component, dir);
        }
    }
Esempio n. 4
0
 public static bool IsDirection(BasePart.JointConnectionDirection direction)
 {
     return(direction == BasePart.JointConnectionDirection.Left || direction == BasePart.JointConnectionDirection.Right || direction == BasePart.JointConnectionDirection.Up || direction == BasePart.JointConnectionDirection.Down);
 }
Esempio n. 5
0
 public static BasePart.Direction ConvertDirection(BasePart.JointConnectionDirection direction)
 {
     return((BasePart.Direction)(direction - 1));
 }