Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        UnityEngine.Debug.Log("Start");

        Loom.Initialize();

        initWorkers(workers);

        foreach (Thread w in workers)
        {
            w.Start();
        }

        Vector3 ratio = ledseq.getRatio();

        objectsWorld   = new Bounds(objectWorldCenter, 2 * objectWorldExtend * ratio);
        particlesWorld = new Bounds(particlesWorldCenter, 2 * particlesWorldExtend * ratio);

        if (NeedSaveSeq)
        {
            ledseq.open(SeqName, SeqFrames);
        }

        if (NeedObjectVox)
        {
            initVoxObjects(objs);
            initMeshListeners(liss);
            vox = initMeshVox(ledseq, objectsWorld, objs);
            vox.Start();
            MeshVox.setGradientColor(NeedGradientColor, 1, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff);
            MeshVox.setSolidFill(NeedSolidFill);
            MeshVox.setFillColor(fillColor);
        }

        if (NeedParticleVox)
        {
            initParticleObjects(pos);
            initParticleListeners(pliss);
            pvox = initParticleVox(ledseq, particlesWorld, pos);
        }

        if (NeedClickRipple)
        {
            glow     = GameObject.Find("/Glow");
            glowps   = glow.GetComponent <ParticleSystem>();
            ripple   = GameObject.Find("/Ripple");
            rippleps = ripple.GetComponent <ParticleSystem>();
            if (ripple.GetComponent <IParticleObject>() != null)
            {
                pos.Add(ripple.GetComponent <IParticleObject>());
            }
        }

        if (NeedEmulator)
        {
            emulator = initEmulator(ledseq);
            ledWorld = emulator.getLedBound();
            GameObject marker = new GameObject("Marker");
            marker.transform.position = ledWorld.center;
        }

        if (NeedInteraction)
        {
            interaction = new LEDInteractionManager(emulator, this);
        }

        if (NeedBridge)
        {
            bridge = initBridge(ledseq);
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("Start");

        Loom.Initialize();

        //touchControlThread = new Thread(touchControl);
        //touchControlThread.Start();

        //sonicControlThread = new Thread(sonicControl);
        //sonicControlThread.Start();

        //gestureControlThread = new Thread(gestureControl);
        //gestureControlThread.Start();

        giraffe      = GameObject.Find("/Giraffe");
        dolphin      = GameObject.Find("/dolphin");
        fish         = GameObject.Find("transformFizzBait");
        fishanimator = GameObject.Find("/fish");
        sth          = GameObject.Find("/sth");
        glow         = GameObject.Find("/Glow");
        glowps       = glow.GetComponent <ParticleSystem>();
        ripple       = GameObject.Find("/Ripple");
        rippleps     = ripple.GetComponent <ParticleSystem>();
        bubble       = GameObject.Find("/bubble");
        buddy        = GameObject.Find("U_Char");
        face         = GameObject.Find("Bruce_Willis_Face");
        stag         = GameObject.Find("STAG/STAG");

        GameObject test    = GameObject.Find("/test");
        GameObject mermaid = GameObject.Find("/Mermaid/Mermaid");

        Animator aa = null;

        if (fishanimator != null)
        {
            aa       = fishanimator.GetComponent <Animator>();
            aa.speed = 0.4f;
        }

        //objectsWorld = new Bounds(new Vector3(0, 11.5f, 0), new Vector3(7, 11.5f, 7) * 2);
        //particlesWorld = new Bounds(new Vector3(0, 36, 0), new Vector3(18, 36, 18) * 2);

        objectsWorld = new Bounds(new Vector3(0, 9f, 0), new Vector3(18, 9f, 18) * 2);
        //particlesWorld = new Bounds(new Vector3(0, 18, 0), new Vector3(27, 18, 27) * 2);
        particlesWorld = new Bounds(new Vector3(0, 18, 0), new Vector3(27, 18, 27) * 2);

        //ParticleSystem p = GameObject.Find("/FireworksGood").GetComponent<ParticleSystem>();
        HashSet <IParticleObject> pos = new HashSet <IParticleObject>
        {
            //new ParticleSystemObject(particlesWorld, rippleps, new Vector2())
        };


        objs = new HashSet <IMeshObject> {
            //new VoxObject {
            //    gameObject = GameObject.Find("11_Hand_Right"),
            //    mode = MeshMode.MeshFilterMode,
            //    transform = GameObject.Find("11_Hand_Right").transform,
            //},
            //new VoxObject {
            //    gameObject = GameObject.Find("07_Hand_Left"),
            //    mode = MeshMode.MeshFilterMode,
            //    transform = GameObject.Find("07_Hand_Left").transform,
            //},
            //new VoxObject {
            //    gameObject = face,
            //    mode = MeshMode.SkinnedMeshRendererMode,
            //    transform = face.transform,
            //},
            //new VoxObject {
            //    gameObject = buddy,
            //    mode = MeshMode.SkinnedMeshRendererMode,
            //    transform = buddy.transform,
            //},
            //new VoxObject{
            //    gameObject = dd,
            //    mode = MeshMode.MeshFilterMode,
            //    transform = dd.transform
            //},
        };

        //extract(new Transform[]
        //{
        //    //GameObject.Find("/flower01").transform,
        //    //GameObject.Find("/flower02").transform,
        //    //GameObject.Find("/flower03").transform,
        //    //GameObject.Find("/flower05").transform,
        //    //GameObject.Find("/rose").transform,
        //    //GameObject.Find("/flower06").transform,
        //}, objs);

        //CubeLedSeq s = new CubeLedSeq(21, 33, 21);
        //CylinderLeqSeq s = new CylinderLeqSeq(56, 12, 7, 7, 5, 7);
        CylinderLeqSeq s = new CylinderLeqSeq(25, 8, 15f, 15f, 6f, 8.5f);

        //CylinderLeqSeq s = new CylinderLeqSeq(40, 12, 15f, 15f, 6f, 8.5f);

        //CylinderLeqSeq s = new CylinderLeqSeq(32, 2, 15, 15, 6, 0);

        //CylinderLeqSeq s = new CylinderLeqSeq(80, 18, 15, 15, 6, 0);

        ledseq = s;
        //s.open("C:\\Users\\yqf\\Desktop\\test.ledseq", 30 * 20);
        //vox = new CubeMeshVox(s, objs, objectsWorld);

        //vox = new CylinderMeshVox(s, objectsWorld, objs);
        vox.Start();
        MeshVox.setGradientColor(false, 1, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff);
        MeshVox.setSolidFill(true);
        //MeshVox.setFillColor(0x7f7f7f00);

        pvox = new CylinderParticleVox(s, particlesWorld, pos);

        //matrix = new CubeLedMatrix(s);
        matrix = new CylinderLedMatrix(s);
        //bridge = new CylinderBigLedBridge(s);
        ledWorld = matrix.getLedBound();
    }