예제 #1
0
    private void Start()
    {
        generatedMesh = new Mesh();
        GetComponent <MeshFilter>().mesh = generatedMesh;


        switch (type)
        {
        case ObjectType.none:
            Debug.LogError("No Object Selected at Crazy Generate");
            break;

        case ObjectType.sphere:
            SphereGen sphere = new SphereGen();
            CreateObject(sphere);
            break;

        case ObjectType.torus:
            TorusGen torus = new TorusGen();
            CreateObject(torus);
            break;

        case ObjectType.cylinder:
            CylinderGen cylinder = new CylinderGen();
            CreateObject(cylinder);
            break;

        case ObjectType.fortuneCookie:
            FortuneCookieGen fortuneCookie = new FortuneCookieGen();
            CreateObject(fortuneCookie);
            break;

        case ObjectType.wheel:
            WheelGen wheel = new WheelGen();
            CreateObject(wheel);
            break;

        case ObjectType.cone:
            ConeGen cone = new ConeGen();
            CreateObject(cone);
            break;

        case ObjectType.spiral:
            SpiralGen sprial = new SpiralGen();
            CreateObject(sprial);
            break;

        default:
            Debug.LogError("Default Object Selected at Crazy Generate");
            break;
        }
    }
 //when called, gen the sphere through the mesh filter
 private void Awake()
 {
     GetComponent <MeshFilter>().mesh = SphereGen.Create(sphereSub, sphereRad);
 }