本文整理汇总了C#中Slider.GetComponentInChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Slider.GetComponentInChildren方法的具体用法?C# Slider.GetComponentInChildren怎么用?C# Slider.GetComponentInChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slider
的用法示例。
在下文中一共展示了Slider.GetComponentInChildren方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
GameObject thePlayer = GameObject.FindGameObjectWithTag("Player");
thePlayerController = thePlayer.GetComponent<PlayerController>();
theAbilities = thePlayer.GetComponentInChildren<PlayerAbilities>();
healthBar = GameObject.FindGameObjectWithTag("healthBar").GetComponent<Slider>();
healthValue = healthBar.GetComponentInChildren<Text>();
theKing = GameObject.FindGameObjectWithTag("theKing").GetComponent<KingControl>();
bossHealthBar = GameObject.FindGameObjectWithTag("bossHealthBar").GetComponent<Slider>();
bossHealthValue = bossHealthBar.GetComponentInChildren<Text>();
ability1 = GameObject.FindGameObjectWithTag("ability1").GetComponent<Image>();
cdSlider1 = ability1.GetComponentInChildren<Slider>();
cdText1 = cdSlider1.GetComponentInChildren<Text>();
ability2 = GameObject.FindGameObjectWithTag("ability2").GetComponent<Image>();
cdSlider2 = ability2.GetComponentInChildren<Slider>();
cdText2 = cdSlider2.GetComponentInChildren<Text>();
ability3 = GameObject.FindGameObjectWithTag("ability3").GetComponent<Image>();
cdSlider3 = ability3.GetComponentInChildren<Slider>();
cdText3 = cdSlider3.GetComponentInChildren<Text>();
powerUpPanel = GameObject.FindGameObjectWithTag("powerUpPanel").GetComponent<RectTransform>();
}
示例2: Start
// Use this for initialization
void Start()
{
healthSlider = GetComponentInChildren<Slider>();
healthText = healthSlider.GetComponentInChildren<Text>();
ps = gameObject.GetComponentInParent<PlayerStats>();
canv = gameObject.GetComponentInParent<Canvas>();
fill = healthSlider.transform.FindChild("Fill Area").FindChild("Fill").GetComponent<Image>();
nameText = transform.parent.GetComponentInChildren<Text>();
}
示例3: Start
void Start () {
slider=GetComponentInChildren<Slider>();
label=transform.FindChild("Text").GetComponent<Text>();
image=GetComponentInChildren<RawImage>();
background=GetComponentInChildren<Image>();
sliderLabel=slider.GetComponentInChildren<Text>();
transform.localScale=Vector3.zero;
transform.DOScale(Vector3.one, 1f).SetEase(Ease.OutElastic);
}
示例4: Start
private void Start()
{
slider = GetComponent<Slider>();
if (target == null)
target = slider.GetComponentInChildren<Image>();
slider.onValueChanged.AddListener(OnValueChanged);
OnValueChanged(slider.value);
}
示例5: Start
// Use this for initialization
void Start () {
mSlider = GetComponent<Slider>();
if (mSlider == null) {
Debug.LogError(" 'uSliderColors' can't find 'Slider'.");
return;
}
if (target == null) {
target = mSlider.GetComponentInChildren<Image>();
}
UnityAction<float> valueChange = new UnityAction<float>(OnValueChanged);
mSlider.onValueChanged.AddListener(valueChange);
OnValueChanged(mSlider.value);
}
示例6: Start
// Use this for initialization
void Start()
{
playerUI = transform.FindChild("Player").gameObject;
healthSlider = playerUI.gameObject.GetComponentInChildren<Slider>();
healthText = healthSlider.GetComponentInChildren<Text>();
playerNameText = healthSlider.transform.parent.Find("Name").GetComponentInChildren<Text>();
actionBar = transform.FindChild("ActionBar").gameObject;
ability1 = actionBar.GetComponentsInChildren<Image>()[1]; // index 0 is the picture behind index 1
ability2 = actionBar.GetComponentsInChildren<Image>()[3]; // index 2 is the picture behind index 3
ability3 = actionBar.GetComponentsInChildren<Image>()[5]; // index 4 is the picture behind index 5
// index 7 is border
trap1 = actionBar.transform.FindChild("Traps").GetComponentsInChildren<Image>()[1]; // index 0 is the picture behind index 1
trap2 = actionBar.transform.FindChild("Traps").GetComponentsInChildren<Image>()[3]; // index 2 is the picture behind index 3
trap3 = actionBar.transform.FindChild("Traps").GetComponentsInChildren<Image>()[5]; // index 4 is the picture behind index 5
trapImages = actionBar.transform.FindChild("Traps").GetComponent<TrapResources>();
if (!scoreBoard)
scoreBoard = GameObject.Find("ScoreBoard").GetComponent<ScoreBoard>();
if (!scoreBoard) {
GameObject ScoreBoard = Instantiate(Resources.Load("Prefabs/GUI/ScoreBoard"), new Vector3(), Quaternion.identity) as GameObject;
ScoreBoard.transform.parent = transform.parent;
ScoreBoard.name = "ScoreBoard";
scoreBoard = ScoreBoard.GetComponent<ScoreBoard>();
}
scoreBoard.showScoreBoard = false;
inventory = transform.FindChild("Inventory").GetComponent<Inventory>();
castBar = transform.FindChild("CastBar").GetComponent<Slider>();
castBar.gameObject.SetActive(false);
// Reset the silly timers
trap1Timer = -trap1Cooldown;
trap2Timer = -trap2Cooldown;
trap3Timer = -trap3Cooldown;
}
示例7: Start
public void Start()
{
if (CurrentMenu == null)
{
if (Application.loadedLevel == 0)
{
CurrentMenu = mainMenu;
}
else if (Application.loadedLevel != 0)
{
CurrentMenu = pauseMenu;
}
}
ShowMenuNoClick(CurrentMenu);
difficulty = GameObject.Find("Difficulty Slider").GetComponent<Slider>();
difficultyText = difficulty.GetComponentInChildren<Text>();
masterVolume = GameObject.Find("Master Volume Slider").GetComponent<Slider>();
musicVolume = GameObject.Find("Music Volume Slider").GetComponent<Slider>();
masterSFXVolume = GameObject.Find("Master SFX Volume Slider").GetComponent<Slider>();
difficulty.value = GameControl.control.difficultyFactor;
masterVolume.value = GameControl.control.masterVolume;
musicVolume.value = GameControl.control.musicVolume;
masterSFXVolume.value = GameControl.control.masterSFXVolume;
resolutions = Screen.resolutions;
resolutionDropdown.options.Clear();
fullScreenToggle.isOn = Screen.fullScreen;
for (int i = 0; i < resolutions.Length; i++)
{
resolutionDropdown.options.Add(new Dropdown.OptionData(ResToString(resolutions[i])));
}
resolutionDropdown.onValueChanged.AddListener
(delegate {
oldTimeScale = Time.timeScale;
Screen.SetResolution(resolutions[resolutionDropdown.value].width,
resolutions[resolutionDropdown.value].height, Screen.fullScreen);
Time.timeScale = 1.0f;
StartCoroutine(RefreshScreen());
});
resolutionDropdown.value = resolutions.Length - 1;
}