コード例 #1
0
    public void Remove(ReflectableRay ray)
    {
        int angle           = getIntAngle(ray.transform.rotation.eulerAngles.z);
        int reflectionAngle = reflectTo[angle];

        if (emission[reflectionAngle] != null)
        {
            Destroy(emission[reflectionAngle].gameObject);
            emission[reflectionAngle] = null;
        }
    }
コード例 #2
0
    public void Incoming(ReflectableRay ray)
    {
        int angle           = getIntAngle(ray.transform.rotation.eulerAngles.z);
        int reflectionAngle = reflectTo[angle];

        GameObject newObject = Instantiate(ray.gameObject) as GameObject;

        Vector3 direction = getDirection(reflectionAngle);

        newObject.transform.position = transform.position + direction / 2.0f;
        newObject.transform.rotation = Quaternion.AngleAxis(getDegreeAngle(reflectionAngle), Vector3.forward);

        if (emission[reflectTo[angle]] != null)
        {
            Destroy(emission[reflectionAngle].gameObject);
        }
        emission[reflectionAngle]           = newObject.GetComponent <ReflectableRay>();
        emission[reflectionAngle].rayOrigin = transform.position - newObject.transform.position;
    }