Ejemplo n.º 1
0
 private void SetSideMaterial(SuperCube aCube, PivotType aSide, Material aMaterial)
 {
     if (aSide == PivotType.None)
     {
         return;
     }
     else if (aSide == PivotType.All)
     {
         aCube.GetComponent <Renderer>().sharedMaterial = aMaterial;
     }
     else if ((aSide & PivotType.Back) > 0)
     {
         aCube.OverrideBack = aMaterial;
     }
     else if ((aSide & PivotType.Front) > 0)
     {
         aCube.OverrideFront = aMaterial;
     }
     else if ((aSide & PivotType.Top) > 0)
     {
         aCube.OverrideTop = aMaterial;
     }
     else if ((aSide & PivotType.Bottom) > 0)
     {
         aCube.OverrideBottom = aMaterial;
     }
     else if ((aSide & PivotType.Right) > 0)
     {
         aCube.OverrideRight = aMaterial;
     }
     else if ((aSide & PivotType.Left) > 0)
     {
         aCube.OverrideLeft = aMaterial;
     }
 }
Ejemplo n.º 2
0
 private Material GetSideMaterial(SuperCube aCube, PivotType aSide)
 {
     if (aSide == PivotType.None)
     {
         return(null);
     }
     else if (aSide == PivotType.All)
     {
         return(aCube.GetComponent <Renderer>().sharedMaterial);
     }
     else if ((aSide & PivotType.Back) > 0)
     {
         return(aCube.OverrideBack);
     }
     else if ((aSide & PivotType.Front) > 0)
     {
         return(aCube.OverrideFront);
     }
     else if ((aSide & PivotType.Top) > 0)
     {
         return(aCube.OverrideTop);
     }
     else if ((aSide & PivotType.Bottom) > 0)
     {
         return(aCube.OverrideBottom);
     }
     else if ((aSide & PivotType.Left) > 0)
     {
         return(aCube.OverrideLeft);
     }
     else if ((aSide & PivotType.Right) > 0)
     {
         return(aCube.OverrideRight);
     }
     return(null);
 }
Ejemplo n.º 3
0
		private void SetSideMaterial(SuperCube aCube, PivotType aSide, Material aMaterial) {
			if (aSide == PivotType.None) return;
			else if (aSide == PivotType.All) {
				aCube.GetComponent<Renderer>().sharedMaterial = aMaterial;
			} else if ((aSide & PivotType.Back) > 0) {
				aCube.OverrideBack = aMaterial;
			} else if ((aSide & PivotType.Front) > 0) {
				aCube.OverrideFront = aMaterial;
			} else if ((aSide & PivotType.Top) > 0) {
				aCube.OverrideTop = aMaterial;
			} else if ((aSide & PivotType.Bottom) > 0) {
				aCube.OverrideBottom = aMaterial;
			} else if ((aSide & PivotType.Right) > 0) {
				aCube.OverrideRight = aMaterial;
			} else if ((aSide & PivotType.Left) > 0) {
				aCube.OverrideLeft = aMaterial;
			}
		}
Ejemplo n.º 4
0
		private Material GetSideMaterial(SuperCube aCube, PivotType aSide) {
			if (aSide == PivotType.None) return null;
			else if (aSide == PivotType.All) {
				return aCube.GetComponent<Renderer>().sharedMaterial;
			} else if ((aSide & PivotType.Back) > 0) {
				return aCube.OverrideBack;
			} else if ((aSide & PivotType.Front) > 0) {
				return aCube.OverrideFront;
			} else if ((aSide & PivotType.Top) > 0) {
				return aCube.OverrideTop;
			} else if ((aSide & PivotType.Bottom) > 0) {
				return aCube.OverrideBottom;
			} else if ((aSide & PivotType.Left) > 0) {
				return aCube.OverrideLeft;
			} else if ((aSide & PivotType.Right) > 0) {
				return aCube.OverrideRight;
			}
			return null;
		}
Ejemplo n.º 5
0
		private static void AddExtrudeCube(SuperCube aBox, Vector3 aAt, PivotType aPivot, Vector3 aSize) {
			GameObject go = SuperCube.CreatePivot(aBox.transform.InverseTransformPoint(aAt), aPivot, aSize, aBox.GetComponent<Renderer>().sharedMaterial);
			Vector3 pos = go.transform.position;
			go.transform.parent = aBox.transform;
			go.transform.localPosition = pos;
			go.transform.localRotation = Quaternion.identity;
			go.transform.localScale    = Vector3.one;
			go.transform.parent = aBox.transform.parent;
			go.isStatic         = aBox.gameObject.isStatic;
			go.tag              = aBox.gameObject.tag;
			go.layer            = aBox.gameObject.layer;

			SuperCube box = go.GetComponent<SuperCube>();
			box.SliceFaces      = aBox.SliceFaces;
			box.SliceDistance   = aBox.SliceDistance;
			box.WallUVType      = aBox.WallUVType;
			box.WallUVTile      = aBox.WallUVTile;
			box.WallUVOffset    = aBox.WallUVOffset;
			box.TopBottomUVType = aBox.TopBottomUVType;
			box.TopBottomUVTile = aBox.TopBottomUVTile;
			box.TopBottomUVOffset=aBox.TopBottomUVOffset;
			box.OverrideTop     = aBox.OverrideBack;
			box.OverrideBottom  = aBox.OverrideBottom;
			box.OverrideFront   = aBox.OverrideFront;
			box.OverrideLeft    = aBox.OverrideLeft;
			box.OverrideRight   = aBox.OverrideRight;
			box.OverrideTop     = aBox.OverrideTop;
			box.Build(true);
			
			Selection.activeGameObject = go;
			EditorGUIUtility.PingObject(go);
			
		}
Ejemplo n.º 6
0
        private static void AddExtrudeCube(SuperCube aBox, Vector3 aAt, PivotType aPivot, Vector3 aSize)
        {
            GameObject go  = SuperCube.CreatePivot(aBox.transform.InverseTransformPoint(aAt), aPivot, aSize, aBox.GetComponent <Renderer>().sharedMaterial);
            Vector3    pos = go.transform.position;

            go.transform.parent        = aBox.transform;
            go.transform.localPosition = pos;
            go.transform.localRotation = Quaternion.identity;
            go.transform.localScale    = Vector3.one;
            go.transform.parent        = aBox.transform.parent;
            go.isStatic = aBox.gameObject.isStatic;
            go.tag      = aBox.gameObject.tag;
            go.layer    = aBox.gameObject.layer;

            SuperCube box = go.GetComponent <SuperCube>();

            box.SliceFaces        = aBox.SliceFaces;
            box.SliceDistance     = aBox.SliceDistance;
            box.WallUVType        = aBox.WallUVType;
            box.WallUVTile        = aBox.WallUVTile;
            box.WallUVOffset      = aBox.WallUVOffset;
            box.TopBottomUVType   = aBox.TopBottomUVType;
            box.TopBottomUVTile   = aBox.TopBottomUVTile;
            box.TopBottomUVOffset = aBox.TopBottomUVOffset;
            box.OverrideTop       = aBox.OverrideBack;
            box.OverrideBottom    = aBox.OverrideBottom;
            box.OverrideFront     = aBox.OverrideFront;
            box.OverrideLeft      = aBox.OverrideLeft;
            box.OverrideRight     = aBox.OverrideRight;
            box.OverrideTop       = aBox.OverrideTop;
            box.Build(true);

            Selection.activeGameObject = go;
            EditorGUIUtility.PingObject(go);
        }