예제 #1
0
    public override bool WillDie(Transform transform, Vector3 point, Vector3 normal)
    {
        int normx = Mathf.RoundToInt(normal.x), normz = Mathf.RoundToInt(normal.z),
            rightx = Mathf.RoundToInt(-transform.right.x), rightz = Mathf.RoundToInt(-transform.right.z),
            forwardx = Mathf.RoundToInt(transform.forward.x), forwardz = Mathf.RoundToInt(transform.forward.z);

        Vector3 temp = point;

        if (normx == rightx && normz == rightz)
        {
            normal = Quaternion.AngleAxis(90, Vector3.up) * normal;
            temp.x = 0;
        }
        else if (normx == forwardx && normz == forwardz)
        {
            normal = Quaternion.AngleAxis(-90, Vector3.up) * normal;
            temp.z = 0;
        }
        else
        {
            Die();
            return(true);
        }

        normal.y = 0;
        LaserController.AddPosition(transform.TransformPoint(0, point.y, 0), normal);
        return(false);
    }
예제 #2
0
    public override bool WillDie(Transform transform, Vector3 point, Vector3 normal)
    {
        Vector3 temp = point;

        if (normal == -transform.forward || normal == transform.forward)
        {
            normal = Quaternion.AngleAxis(-90, Vector3.up) * normal;
            temp.z = 0;
        }
        else if (normal == transform.right || normal == -transform.right)
        {
            normal = Quaternion.AngleAxis(90, Vector3.up) * normal;
            temp.x = 0;
        }

        normal.y = 0;
        LaserController.AddPosition(transform.TransformPoint(Vector3.zero), normal);
        return(false);
    }