本文整理汇总了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 ();
//.........这里部分代码省略.........