本文整理汇总了C#中Slider.GetComponentsInChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Slider.GetComponentsInChildren方法的具体用法?C# Slider.GetComponentsInChildren怎么用?C# Slider.GetComponentsInChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slider
的用法示例。
在下文中一共展示了Slider.GetComponentsInChildren方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
void Awake()
{
//POBIERAMY SLIDER
sld = GetComponent<Slider>() ;
//POBIERAMY WSZYSTKIE DZIEIC KTORE POSIADAJA COMPONENT Image
img = sld.GetComponentsInChildren<Image>() ;
}
示例2: Awake
void Awake() {
foreach (Text t in GetComponentsInChildren<Text>()) {
if (t.gameObject.name == "curpos_text") {
videoPosition = t;
} else if (t.gameObject.name == "duration_text") {
videoDuration = t;
}
}
foreach (RawImage raw in GetComponentsInChildren<RawImage>(true)) {
if (raw.gameObject.name == "playImage") {
playSprite = raw.gameObject;
} else if (raw.gameObject.name == "pauseImage") {
pauseSprite = raw.gameObject;
}
}
foreach (Slider s in GetComponentsInChildren<Slider>(true)) {
if (s.gameObject.name == "video_slider") {
videoScrubber = s;
videoScrubber.maxValue = 100;
videoScrubber.minValue = 0;
foreach (Image i in videoScrubber.GetComponentsInChildren<Image>()) {
if (i.gameObject.name == "BufferedBackground") {
bufferedBackground = i.gameObject;
}
}
} else if (s.gameObject.name == "volume_slider") {
volumeSlider = s;
}
}
foreach (RectTransform obj in GetComponentsInChildren<RectTransform>(true)) {
if (obj.gameObject.name == "volume_widget") {
volumeWidget = obj.gameObject;
} else if (obj.gameObject.name == "settings_panel") {
settingsPanel = obj.gameObject;
}
}
}
示例3: InterpolateColour
/// <summary>
/// Gives a smooth colour to the slider
/// </summary>
/// <param name="slider">the slider to give a colour to</param>
private void InterpolateColour(Slider slider)
{
Image fill = slider.GetComponentsInChildren<Image>().FirstOrDefault(t => t.name == Fill);
fill.color = Color.Lerp(minHealthColor, maxHealthColor, slider.value/1);
}
示例4: Start
// Use this for initialization
protected new void Start()
{
model = Instantiate(modelPrefab, transform.position, transform.rotation) as Transform;
model.SetParent(transform, true);
guiCanvas = GameObject.Find ("HUD");
base.Start();
_state = EnemyPlaneState.STATE_PATROL;
_healthBar = transform.Find("Health").GetComponent<Slider>();
_healthBar.transform.SetParent(guiCanvas.transform);
_healthFill = _healthBar.GetComponentsInChildren<UnityEngine.UI.Image>()
.FirstOrDefault(t => t.name == "Fill");
//TODO: Find front of colliders
frontOfPlane = 9.76f;
//TODO: Read the waypoints and start position from a file or the scene.
_wayPoints = new List<Vector2>();
addWayPoint(0.0f, 4.0f);
addWayPoint(-1.0f, 5.0f);
addWayPoint(-4.0f, 5.0f);
addWayPoint(-5.0f, 4.0f);
addWayPoint(-5.0f, 1.0f);
addWayPoint(-4.0f, 0.0f);
addWayPoint(2.0f, 0.0f);
addWayPoint(3.0f, -1.0f);
addWayPoint(3.0f, -2.0f);
addWayPoint(2.0f, -3.0f);
addWayPoint(1.0f, -3.0f);
addWayPoint(0.0f, -2.0f);
_player = GameObject.Find("PlayerPlane");
if (_player != null)
{
_playerPlane = _player.GetComponent<PlayerPlaneScript>();
_playerPlane.addEnemy(this);
_arrow = transform.FindChild("Arrow").gameObject;
_arrow.transform.SetParent(null);
}
}