예제 #1
0
    public override void Initialize(Vector3 surfacePosition)
    {
        base.Initialize(surfacePosition);

        sampler.SampleMesh(false);

        meshBounds = sampler.Bounds;

        boids        = new Boid[numBoids];
        surfaceBoids = new SurfaceBoid[numBoids];
        boidMatrices = new Matrix4x4[numBoids];
        for (int i = 0; i < numBoids; i++)
        {
            Boid       b = new Boid();
            MeshSample s = sampler.Samples[Random.Range(0, sampler.Samples.Length)];
            b.Position = s.UV;
            b.Rotation = Random.Range(0, 360);
            boids[i]   = b;

            SurfaceBoid sb = new SurfaceBoid();
            sb.Offset       = Random.value;
            surfaceBoids[i] = sb;
        }

        forces = new Force[fingers.Length];
    }
예제 #2
0
    public override void Initialize(Vector3 surfacePosition)
    {
        base.Initialize(surfacePosition);

        emptyBlock = new MaterialPropertyBlock();

        sampler.SampleMesh();

        blorbs          = new Blorb[sampler.Samples.Length];
        matrixes        = new Matrix4x4[sampler.Samples.Length];
        fingerPositions = new Vector3[fingers.Length];

        for (int i = 0; i < sampler.Samples.Length; i++)
        {
            MeshSample sample = sampler.Samples[i];
            Blorb      e      = new Blorb();
            e.Point         = sample.Point;
            e.Dir           = e.Point.normalized;
            e.Radius        = Random.Range(minRadius, maxRadius);
            e.Agitation     = Random.value;
            e.Goop          = GameObject.Instantiate(goopBlorbPrefabs[Random.Range(0, goopBlorbPrefabs.Length)], transform).GetComponent <GoopBlorb>();
            e.Rotation      = Random.Range(0, 360);
            e.RotationSpeed = Random.Range(-rotationSpeed, rotationSpeed);
            blorbs[i]       = e;
        }

        timeLastPopped = -100;

        updateBlorbs = true;
        Task updateTask = UpdateBlorbsLoop();
    }
예제 #3
0
    public override void Initialize(Vector3 surfacePosition)
    {
        base.Initialize(surfacePosition);

        sampler.SampleMesh(true);

        for (int i = 0; i < surfaceArcs.Length; i++)
        {
            MeshSample point1 = sampler.Samples[Random.Range(0, sampler.Samples.Length)];
            MeshSample point2 = sampler.Samples[Random.Range(0, sampler.Samples.Length)];
            surfaceArcs[i].SetArc(point1, point2, Vector3.zero, SurfaceRadius);
        }

        buzzAudio.pitch = 0;
    }
예제 #4
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            MeshSampler ms = (MeshSampler)target;

            if (GUILayout.Button("Digest Mesh"))
            {
                ms.DigestMesh();
            }
            if (GUILayout.Button("Sample Random Points"))
            {
                ms.SampleMesh();
            }
            if (GUILayout.Button("Create Spherical Disp Map"))
            {
                ms.CreateSphereDispMap(true);
            }
        }