本文整理匯總了C#中AC.SetCentre方法的典型用法代碼示例。如果您正苦於以下問題:C# AC.SetCentre方法的具體用法?C# AC.SetCentre怎麽用?C# AC.SetCentre使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AC
的用法示例。
在下文中一共展示了AC.SetCentre方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: UpdateMenuPosition
/**
* <summary>Updates a Menu's position.</summary>
* <param name = "menu">The Menu to reposition</param>
* <param name = "invertedMouse">The y-inverted mouse position</param>
*/
public void UpdateMenuPosition(AC.Menu menu, Vector2 invertedMouse)
{
if (menu.IsUnityUI ())
{
if (Application.isPlaying)
{
Vector2 screenPosition = Vector2.zero;
if (menu.uiPositionType == UIPositionType.Manual)
{
return;
}
else if (menu.uiPositionType == UIPositionType.FollowCursor)
{
screenPosition = new Vector2 (invertedMouse.x, Screen.height + 1f - invertedMouse.y);
menu.SetCentre (screenPosition);
}
else if (menu.uiPositionType == UIPositionType.OnHotspot)
{
if (!menu.IsFadingOut ())
{
if (mouseOverInventory)
{
screenPosition = new Vector2 (activeInventoryBoxCentre.x, Screen.height + 1f - activeInventoryBoxCentre.y);
menu.SetCentre (screenPosition);
}
else if (KickStarter.playerInteraction.GetActiveHotspot ())
{
if (menu.canvas.renderMode == RenderMode.WorldSpace)
{
menu.SetCentre (KickStarter.playerInteraction.GetActiveHotspot ().transform.position);
}
else
{
screenPosition = KickStarter.playerInteraction.GetHotspotScreenCentre ();
screenPosition = new Vector2 (screenPosition.x * Screen.width, (1f - screenPosition.y) * Screen.height);
menu.SetCentre (screenPosition);
}
}
}
}
else if (menu.uiPositionType == UIPositionType.AboveSpeakingCharacter)
{
Char speaker = null;
if (dupMenus.Contains (menu))
{
if (menu.speech != null)
{
speaker = menu.speech.GetSpeakingCharacter ();
}
}
else
{
speaker = KickStarter.dialog.GetSpeakingCharacter ();
}
if (speaker != null)
{
if (menu.canvas.renderMode == RenderMode.WorldSpace)
{
menu.SetCentre (speaker.transform.position);
}
else
{
screenPosition = speaker.GetScreenCentre ();
screenPosition = new Vector2 (screenPosition.x * Screen.width, (1f - screenPosition.y) * Screen.height);
menu.SetCentre (screenPosition);
}
}
}
else if (menu.uiPositionType == UIPositionType.AbovePlayer)
{
if (KickStarter.player)
{
if (menu.canvas.renderMode == RenderMode.WorldSpace)
{
menu.SetCentre (KickStarter.player.transform.position);
}
else
{
screenPosition = KickStarter.player.GetScreenCentre ();
screenPosition = new Vector2 (screenPosition.x * Screen.width, (1f - screenPosition.y) * Screen.height);
menu.SetCentre (screenPosition);
}
}
}
}
return;
}
if (invertedMouse == Vector2.zero)
{
invertedMouse = KickStarter.playerInput.GetInvertedMouse ();
//.........這裏部分代碼省略.........