示例#1
0
        private void DrawPanelMeshGeneratorChain()
        {
            RopeMeshChainGenerator meshGenerator = _meshGenerator as RopeMeshChainGenerator;

            if (meshGenerator == null)
            {
                meshGenerator  = new RopeMeshChainGenerator();
                _meshGenerator = meshGenerator;
            }
            meshGenerator.SourceObject  = (GameObject)EditorGUILayout.ObjectField(meshGenerator.SourceObject, typeof(GameObject), true);
            meshGenerator.ChainsPerBone = EditorGUILayout.IntField("Chains per bone", meshGenerator.ChainsPerBone);
            meshGenerator.Scale         = EditorGUILayout.FloatField("Scale", meshGenerator.Scale);

            _initialRotation = EditorGUILayout.Vector3Field("Initial rotation", _initialRotation);
            meshGenerator.InitialRotation = Quaternion.Euler(_initialRotation);

            _stepRotation = EditorGUILayout.Vector3Field("Step rotation", _stepRotation);
            meshGenerator.StepRotation = Quaternion.Euler(_stepRotation);

            if (meshGenerator.SourceObject != null)
            {
                var renderer = meshGenerator.SourceObject.GetComponent <Renderer>();
                if (renderer == null)
                {
                    throw new ArgumentException("No renderer found");
                }
                meshGenerator.Materials = renderer.sharedMaterials;
            }
            else
            {
                meshGenerator.Materials = null;
            }
        }
        private void DrawPanelMeshGeneratorCylinder()
        {
            RopeMeshCylinderGenerator meshGenerator = _meshGenerator as RopeMeshCylinderGenerator;

            if (meshGenerator == null)
            {
                meshGenerator  = new RopeMeshCylinderGenerator();
                _meshGenerator = meshGenerator;
            }
            meshGenerator.Sides           = EditorGUILayout.IntField("Sides", meshGenerator.Sides);
            meshGenerator.SegmentsPerBone = EditorGUILayout.IntField("Segments per bone", meshGenerator.SegmentsPerBone);
        }
示例#3
0
        private void DrawPanelMeshGeneratorCylinder()
        {
            RopeMeshCylinderGenerator meshGenerator = _meshGenerator as RopeMeshCylinderGenerator;

            if (meshGenerator == null)
            {
                meshGenerator  = new RopeMeshCylinderGenerator();
                _meshGenerator = meshGenerator;
            }
            meshGenerator.Sides           = EditorGUILayout.IntField("Sides", meshGenerator.Sides);
            meshGenerator.RadiusStart     = EditorGUILayout.FloatField("Radius Start", meshGenerator.RadiusStart);
            meshGenerator.RadiusStop      = EditorGUILayout.FloatField("Radius Stop", meshGenerator.RadiusStop);
            meshGenerator.SegmentsPerBone = EditorGUILayout.IntField("Segments per bone", meshGenerator.SegmentsPerBone);
            meshGenerator._material       = (Material)EditorGUILayout.ObjectField("Material", meshGenerator._material, typeof(Material), true);
        }
示例#4
0
 public RopeGenerator(IRopeMeshGenerator meshGenerator, Material material, GameObject parrent)
 {
     _meshGenerator = meshGenerator;
     _material      = material;
     _parrent       = parrent;
 }
示例#5
0
 public RopeGenerator(IRopeMeshGenerator meshGenerator, GameObject parrent)
 {
     _meshGenerator = meshGenerator;
     _parrent       = parrent;
 }