UIPanel.IsVisible(UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.Vector3)

Here are the examples of the csharp api UIPanel.IsVisible(UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.Vector3) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

19 View Source File : UIPanel.cs
License : Apache License 2.0
Project Creator : 365082218

public bool IsVisible (UIWidget w)
	{
		if (mAlpha < 0.001f) return false;
		if (!w.enabled || !NGUITools.GetActive(w.gameObject) || w.alpha < 0.001f) return false;

		// No clipping? No point in checking.
		if (mClipping == UIDrawCall.Clipping.None) return true;

		Vector2 size = w.relativeSize;
		Vector2 a = Vector2.Scale(w.pivotOffset, size);
		Vector2 b = a;

		a.x += size.x;
		a.y -= size.y;

		// Transform coordinates into world space
		Transform wt = w.cachedTransform;
		Vector3 v0 = wt.TransformPoint(a);
		Vector3 v1 = wt.TransformPoint(new Vector2(a.x, b.y));
		Vector3 v2 = wt.TransformPoint(new Vector2(b.x, a.y));
		Vector3 v3 = wt.TransformPoint(b);
		return IsVisible(v0, v1, v2, v3);
	}

19 View Source File : UIPanel.cs
License : GNU General Public License v3.0
Project Creator : aelariane

public bool IsVisible(UIWidget w)
    {
        if (this.mAlpha < 0.001f)
        {
            return false;
        }
        if (!w.enabled || !NGUITools.GetActive(w.cachedGameObject) || w.alpha < 0.001f)
        {
            return false;
        }
        if (this.mClipping == UIDrawCall.Clipping.None)
        {
            return true;
        }
        Vector2 relativeSize = w.relativeSize;
        Vector2 vector = Vector2.Scale(w.pivotOffset, relativeSize);
        Vector2 v = vector;
        vector.x += relativeSize.x;
        vector.y -= relativeSize.y;
        Transform cachedTransform = w.cachedTransform;
        Vector3 a = cachedTransform.TransformPoint(vector);
        Vector3 b = cachedTransform.TransformPoint(new Vector2(vector.x, v.y));
        Vector3 c = cachedTransform.TransformPoint(new Vector2(v.x, vector.y));
        Vector3 d = cachedTransform.TransformPoint(v);
        return this.IsVisible(a, b, c, d);
    }

19 View Source File : UIPanel.cs
License : MIT License
Project Creator : mamoniem

public bool IsVisible (UIWidget w)
	{
		UIPanel p = this;
		Vector3[] corners = null;

		while (p != null)
		{
			if ((p.mClipping == UIDrawCall.Clipping.None || p.mClipping == UIDrawCall.Clipping.ConstrainButDontClip) && !w.hideIfOffScreen)
			{
				p = p.mParentPanel;
				continue;
			}

			if (corners == null) corners = w.worldCorners;
			if (!p.IsVisible(corners[0], corners[1], corners[2], corners[3])) return false;
			p = p.mParentPanel;
		}
		return true;
	}