当前位置: 首页>>代码示例>>C#>>正文


C# Slider.GetComponentInChildren方法代码示例

本文整理汇总了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>();
    }
开发者ID:hduuong,项目名称:AttackFromTheDepths,代码行数:29,代码来源:HUDScript.cs

示例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>();
 }
开发者ID:PeWiNi,项目名称:MonguinsAndBeyond,代码行数:10,代码来源:HealthSlider.cs

示例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);
	}
开发者ID:JuanJosePol,项目名称:ggjmallorca2016,代码行数:9,代码来源:InfoSlotController.cs

示例4: Start

        private void Start()
        {
            slider = GetComponent<Slider>();
            if (target == null)
                target = slider.GetComponentInChildren<Image>();

            slider.onValueChanged.AddListener(OnValueChanged);
            OnValueChanged(slider.value);
        }
开发者ID:eyesno,项目名称:vanitymetrics,代码行数:9,代码来源:SliderColors.cs

示例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);
		}
开发者ID:RainsSoft,项目名称:ugui-Tween-Tool,代码行数:14,代码来源:uSliderColors.cs

示例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;
    }
开发者ID:PeWiNi,项目名称:MonguinsAndBeyond,代码行数:36,代码来源:HUDScript.cs

示例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;
    }
开发者ID:Tmstofferahn,项目名称:Sinister-Overhaul,代码行数:46,代码来源:MenuManager.cs


注:本文中的Slider.GetComponentInChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。