本文整理汇总了C#中HUD.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# HUD.GetComponent方法的具体用法?C# HUD.GetComponent怎么用?C# HUD.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HUD
的用法示例。
在下文中一共展示了HUD.GetComponent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addCamera
public void addCamera(Camera camera, HUD hud)
{
SplitPair pair = new SplitPair(camera, hud);
Canvas hudCanvas = hud.GetComponent<Canvas>();
hudCanvas.worldCamera = camera;
if (topLeft == null) {
topLeft = pair;
} else if (botLeft == null) {
botLeft = pair;
SetOrientation(topLeft, SplitHelper.Orientation.TOP);
SetOrientation(botLeft, SplitHelper.Orientation.BOTTOM);
} else if (topRight == null) {
topRight = pair;
SetOrientation(topLeft, SplitHelper.Orientation.TOP_LEFT);
SetOrientation(topRight, SplitHelper.Orientation.TOP_RIGHT);
} else if (botRight == null) {
botRight = pair;
SetOrientation(botLeft, SplitHelper.Orientation.BOT_LEFT);
SetOrientation(botRight, SplitHelper.Orientation.BOT_RIGHT);
} else {
Debug.Log("WARNING: Too many cameras, SplitHelper only supports 4 cameras");
}
}
示例2: Awake
void Awake()
{
controller = transform.parent.GetComponentInChildren<Controller>();
purchaseManager = transform.parent.FindChild("SOOMLA").GetComponent<PurchaseManager>();
frogPackages = GetComponentInParent<FrogPackages>();
variableManager = GetComponentInParent<VariableManager>();
advertisingManager = GetComponentInParent<AdvertisingManager>();
canvas = GetComponent<RectTransform>();
titleTransform = canvas.FindChild("Title").GetComponent<RectTransform>();
mainMenu = canvas.FindChild("MainMenu").GetComponent<CanvasGroup>();
frogButton = mainMenu.transform.FindChild("FrogButton").GetComponent<RectTransform>();
settingsButton = mainMenu.transform.FindChild("SettingsButton").GetComponent<RectTransform>();
settingsMenu = canvas.FindChild("SettingsPanel").GetComponent<CanvasGroup>();
musicToggle = settingsMenu.transform.GetChild(0).FindChild("MusicToggle").GetComponent<Toggle>();
hud = transform.FindChild("HUD").GetComponent<HUD>();
hudCanvas = hud.GetComponent<CanvasGroup>();
hudRect = hud.GetComponent<RectTransform>();
qualityCountPanelCG = canvas.FindChild("QualityCountPanel").GetComponent<CanvasGroup>();
qualityCountPanel = qualityCountPanelCG.GetComponent<RectTransform>();
perfectCount = qualityCountPanel.FindChild("PerfectCount").GetComponent<TextMeshProUGUI>();
greatCount = qualityCountPanel.FindChild("GreatCount").GetComponent<TextMeshProUGUI>();;
okCount = qualityCountPanel.FindChild("OKCount").GetComponent<TextMeshProUGUI>();;
flyIconPosition = new Vector2(screenWidth, 50);
flyButton = canvas.FindChild ("FlyPanel").GetComponent<Button>();
flyPanelCG = flyButton.GetComponent<CanvasGroup>();
flyTextAnimator = flyButton.transform.FindChild("FlyCount").GetComponent<Animator>();
flyCount = flyButton.transform.FindChild("FlyCount").GetComponent<TextMeshProUGUI>();
flyToGoText = flyButton.transform.FindChild("ToGoText").GetComponent<TextMeshProUGUI>();
tameFlyNet = Instantiate(tameFlyNetPrefab, flyIconPosition, Quaternion.identity) as GameObject;
arrowPanelCG = canvas.FindChild("ArrowPanel").GetComponent<CanvasGroup>();
arrowPanel = arrowPanelCG.GetComponent<RectTransform>();
frogName = arrowPanel.FindChild("FrogName").GetComponent<TextMeshProUGUI>();
arrowPanelBuyButton = arrowPanel.FindChild("BuyButton").gameObject;
returnPanel = canvas.FindChild("ReturnPanel").GetComponent<CanvasGroup>();
returnButton = returnPanel.transform.FindChild("ReturnButton").GetComponent<RectTransform>();
Transform endGameTransform = canvas.FindChild("EndGamePanel");
endGamePanel = endGameTransform.GetComponent<CanvasGroup>();
giftButton = endGameTransform.FindChild("GiftsButton").gameObject;
adButton = endGameTransform.FindChild("AdsButton").gameObject;
timeUntilGiftText = endGameTransform.FindChild("TimeUntilGift").GetComponent<TextMeshProUGUI>();
buyButtonObject = endGameTransform.FindChild("BuyButton").gameObject;
buyButton = buyButtonObject.GetComponent<Button>();
buyButtonText = buyButton.transform.FindChild("Text").GetComponent<TextMeshProUGUI>();
buyButtonImage = buyButton.transform.FindChild("Image").GetComponent<Image>();
}