Beispiel #1
0
    public void onTouch(Vector3 e)
    {
        Ray        ray = Camera.main.ScreenPointToRay(e);
        WorldEvent eventForObj = null, eventForParticle = null;

        float dis;

        if (ledWorld.IntersectRay(ray, out dis))
        {
            Vector3 hit = ray.origin + dis * Vector3.Normalize(ray.direction);
            //Debug.Log("ray " + hit + " " + Input.mousePosition);

            glow.transform.position = hit;

            // translate to the obj and particle world position and OnEvent()
            eventForObj = new WorldEvent()
            {
                position = TranslatePosition(ledWorld, objectsWorld, hit)
            };
            eventForParticle = new WorldEvent()
            {
                position = TranslatePosition(ledWorld, particlesWorld, hit)
            };

            glowps.Play();

            vox.OnInteractionInput(eventForObj);
            ripple.transform.position = eventForParticle.position;
            rippleps.Play();
            pvox.OnInteractionInput(eventForParticle);
        }
    }
Beispiel #2
0
    public void OnInteractionInput(WorldEvent e)
    {
        Vector3    hit = e.position;
        WorldEvent eventForObj = null, eventForParticle = null;

        // translate to the obj and particle world position and OnEvent()
        eventForObj = new WorldEvent()
        {
            position = TranslatePosition(ledWorld, objectsWorld, hit),
            gesture  = e.gesture
        };
        eventForParticle = new WorldEvent()
        {
            position = TranslatePosition(ledWorld, particlesWorld, hit),
            gesture  = e.gesture
        };

        if (NeedClickRipple)
        {
            glow.transform.position = hit;
            glowps.Play();
            ripple.transform.position = eventForParticle.position;
            rippleps.Play();
        }

        if (NeedObjectVox)
        {
            vox.OnInteractionInput(eventForObj);
            foreach (IMeshEventListener l in liss)
            {
                l.OnInteractionInput(eventForObj);
            }
        }
        if (NeedParticleVox)
        {
            pvox.OnInteractionInput(eventForParticle);
            foreach (IParticleEventListener l in pliss)
            {
                l.OnInteractionInput(eventForParticle);
            }
        }
    }