本文整理汇总了C#中UnityEngine.UI.Image类的典型用法代码示例。如果您正苦于以下问题:C# Image类的具体用法?C# Image怎么用?C# Image使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Image类属于UnityEngine.UI命名空间,在下文中一共展示了Image类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetColor
void SetColor(Transform _transform, Color _color)
{
mText = _transform.GetComponent<Text> ();
if (mText != null){
mText.color = _color;
}
mLight = _transform.GetComponent<Light>();
if (mLight != null){
mLight.color = _color;
}
mImage = _transform.GetComponent<Image> ();
if (mImage != null) {
mImage.color = _color;
}
mSpriteRender = _transform.GetComponent<SpriteRenderer> ();
if (mSpriteRender != null) {
mSpriteRender.color = _color;
}
if (_transform.GetComponent<Renderer>() != null) {
mMat = _transform.GetComponent<Renderer>().material;
if (mMat != null) {
mMat.color = _color;
}
}
if (includeChilds) {
for (int i = 0; i < _transform.childCount; ++i) {
Transform child = _transform.GetChild(i);
SetColor(child, _color);
}
}
}
示例2: Start
// Use this for initialization
void Start()
{
_underWater = FindObjectOfType<UnderWater>();
_healthBar = GameObject.FindGameObjectWithTag("HealthBar").GetComponent<Image>();
_damageFlash = GameObject.FindGameObjectWithTag("DamageFlash").GetComponent<Image>();
_currentHealth = _maxHealth;
}
示例3: Start
void Start()
{
//We keep it in game to be able to disconnect/have info on server
DontDestroyOnLoad (gameObject);
panelImage = GetComponent<Image> ();
}
示例4: Awake
private void Awake()
{
characterRectTransform = GetComponent<RectTransform>();
image = GetComponent<Image>();
currentLookDirection = 0;
}
示例5: Awake
void Awake()
{
ToggleGameOverPanel(false);
recognitionBoard = GetComponent<RecognitionBoard>();
RecognitionBoard.GestureRecognized += OnGestureRecognized;
indicatorImage = roundTimeIndicator.GetComponentInChildren<Image>();
}
示例6: Start
// Use this for initialization
void Start () {
anim = GetComponent<Animator> ();
BarVie = GameObject.Find("MainCamera").transform.FindChild("Canvas").FindChild("BarVie").GetComponent<Image>();
SetColor (1);
}
示例7: Create
public void Create(Image beatImage)
{
_beatImage = beatImage;
Vector3 p = GetPosition();
p.y = startPosition;
UpdatePosition(p);
}
示例8: Start
// Use this for initialization
void Start()
{
image = gameObject.GetComponent<UnityEngine.UI.Image>();
index = 0;
total = loadingSprites.Count;
t = loopInterval;
}
示例9: Start
void Start()
{
fadingIn = fadingOut = false;
myImage = this.GetComponent<Image>();
myColor = myImage.color;
Invoke ("fadeIn", timeBeforeFadeIn);
}
示例10: Init
// Use this for initialization
public void Init(float CdTime)
{
m_CdTime = 0.0f;
m_MaxCdTime = CdTime;
m_CdImg = transform.FindChild("cdImg").GetComponent<Image>();
m_CdText = transform.FindChild("cdTime").GetComponent<Text>();
}
示例11: Awake
// Use this for initialization
void Awake()
{
m_Img = GetComponent<Image>();
m_OriginSpr = m_Img.sprite;
m_Type = DungonType.DT_WOLF;
m_IsSelected = false;
}
示例12: Start
void Start ()
{
// Set up and assign variables.
occlusion_image = occlusion_panel.GetComponent<UnityEngine.UI.Image> ();
sidebar_transform = this.gameObject.GetComponent<RectTransform> ();
sidebar_height = sidebar_transform.offsetMax.y - sidebar_transform.offsetMin.y;
}
示例13: Start
// Use this for initialization
private void Start()
{
_normalColor = new Color(0.5f, 0.5f, 0.5f, 0.5f);
_underwaterColor = new Color(0.22f, 0.45f, 0.77f, 0.5f);
_controller = FindObjectOfType<FirstPersonController>();
_breathBar = GameObject.FindGameObjectWithTag("BreathBar").GetComponent<Image>();
}
示例14: SetStat
private void SetStat(Text text, Image icon, int statValue)
{
string statText = "";
if (statValue > 0)
{
statText = "+" + statValue.ToString();
SetColor(text, colorPositive);
SetColor(icon, colorPositive);
}
else if (statValue < 0)
{
statText = statValue.ToString();
SetColor(text, colorNegative);
SetColor(icon, colorNegative);
}
else
{
statText = "0";
SetColor(text, colorNeutral);
SetColor(icon, colorNeutral);
}
SetText(text, statText);
}
示例15: InitGame
//Initializes the game for each level.
public void InitGame()
{
Instantiate (canvas);
mainCamera = GameObject.Find ("Main Camera 2");
//set Level number
levelNumber = GameObject.Find ("LevelNumber").GetComponent<Text> ();
levelNumber.text = "Level "+ level;
//player reference and lifeText setup
playerRef = GameObject.Find ("Player");
playerController = playerRef.GetComponent<PlayerController>();
playerController.score = score;
prePlayerLife = playerController.life;
levelImage = GameObject.Find ("LevelImage");
faderScreen = GameObject.Find ("FaderScreen");
Color.TryParseHexString ("#870000E4", out redSplashColor);
Color.TryParseHexString ("#001187E4", out blueSplashColor);
screenSplash = faderScreen.GetComponent<Image> ();
screenSplash.color = redSplashColor;
levelImage.SetActive (false);
faderScreen.SetActive (false);
playerLifeText = GameObject.Find ("LifePlayer").GetComponent<Text>();
playerScoreText = GameObject.Find ("ScorePlayer").GetComponent<Text>();
//Call the SetupScene function of the BoardManager script, pass it current level number.
boardScript.SetupScene(level);
allBlocks = GameObject.Find ("Blocks");
isGameOver=false;
InitLights();
}