Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        lightRay = LightBeam.Cast(transform.position, transform.up, LayerMask.NameToLayer("BounceLightBeams"));

        int nBounces = lightRay.endPoints.Count;

        lr.positionCount = nBounces + 1;
        lr.SetPosition(0, transform.position + new Vector3(0, 0, -1f));
        for (int i = 0; i < nBounces; i++)
        {
            lr.SetPosition(i + 1, new Vector3(lightRay.endPoints[i].x, lightRay.endPoints[i].y, -1));
        }

        destinations.Clear();
        foreach (GameObject touchedObject in lightRay.touchedObjects)
        {
            LightBeamReceptor receptor = touchedObject.GetComponent <LightBeamReceptor>();
            if (receptor != null)
            {
                destinations.Add(receptor);
                receptor.BeginReceivingLight(this);
            }
        }
    }
Ejemplo n.º 2
0
 public bool isMyDestination(LightBeamReceptor receptor)
 {
     return(destinations.Contains(receptor));
 }