Created
May 26, 2012 19:22
-
-
Save N-Carter/2795037 to your computer and use it in GitHub Desktop.
OnGetFrameBounds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected Bounds OnGetFrameBounds() | |
{ | |
Bounds bounds; | |
if(m_SelectedWaypoints.Count > 0) | |
{ | |
// Focus the selected waypoints: | |
bounds = new Bounds(m_Path.transform.TransformPoint(m_SelectedWaypoints.First().position), Vector3.zero); | |
foreach(var waypoint in m_SelectedWaypoints.Skip(1)) | |
bounds.Encapsulate(m_Path.transform.TransformPoint(waypoint.position)); | |
} | |
else | |
{ | |
// Focus all waypoints and the path's transform.position: | |
bounds = new Bounds(m_Path.transform.position, Vector3.zero); | |
foreach(var waypoint in m_Path.m_Waypoints) | |
bounds.Encapsulate(m_Path.transform.TransformPoint(waypoint.position)); | |
} | |
return bounds; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment