本文整理汇总了C#中Image.CrossFadeAlpha方法的典型用法代码示例。如果您正苦于以下问题:C# Image.CrossFadeAlpha方法的具体用法?C# Image.CrossFadeAlpha怎么用?C# Image.CrossFadeAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image
的用法示例。
在下文中一共展示了Image.CrossFadeAlpha方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
void Awake()
{
top = Top;
bottom = Bottom;
top.CrossFadeAlpha(0f, 0f, false);
bottom.CrossFadeAlpha(0f, 0f, false);
}
示例2: Awake
void Awake()
{
image = this.GetComponent<Image>();
// since unity kindly uses the canvasrenderer instead of the images own alpha
// we need to use this fucking workaround
image.CrossFadeAlpha(0f, 0f, false);
}
示例3: PromptCoroutine
IEnumerator PromptCoroutine(float time, Image prompt, Vector2 promptPosition)
{
prompt.rectTransform.anchoredPosition = promptPosition;
prompt.CrossFadeAlpha(1, 0.1f, true);
var start = promptPosition + new Vector2(0, Random.Range(0.0f, 1.0f) > 0.5f ? -450 : 450);
for (var t = 0.0f; t < 1; t += Time.deltaTime / time)
{
prompt.rectTransform.anchoredPosition = Vector2.Lerp(start, promptPosition, t);
yield return null;
}
prompt.rectTransform.anchoredPosition = promptPosition;
prompt.canvasRenderer.SetAlpha(0);
coroutine = null;
}
示例4: Start
// Use this for initialization
void Start()
{
img = GetComponent<Image> ();
img.CrossFadeAlpha (0, 10f, false);
}
示例5: Start
// Use this for initialization
void Start()
{
fadePanel = GetComponent<Image>();
fadePanel.CrossFadeAlpha(0, fadeDuration, false);
Invoke("RemoveSceneFader", fadeDuration);
}
示例6: Start
//=================\\
//===== Start =====\\
//=================\\
void Start()
{
_audioController = FindObjectOfType<AudioController> ().gameObject.GetComponent<AudioController> ();
showError = false;
hospitalAvailable = false;
farmAvailable = false;
waterstationAvailable = false;
powerstationAvailable = false;
storageAvailable = false;
traininggroundAvailable = false;
_gameController = GameObject.Find ("GameController").GetComponent<GameController> ();
myCamObj = GameObject.Find ("CameraObject");
myCanvas = GameObject.Find ("Canvas").GetComponent <Canvas>();
selectedIcon = GetComponentInChildren<SpriteRenderer>();
//===============================\\
//=== Settler Info Background ===\\
//===============================\\
SettlerInfoDelBg = (Image)Instantiate (SettlerInfoBg);
SettlerInfoDelBg.gameObject.transform.SetParent (myCanvas.gameObject.transform);
SettlerInfoDelBg.rectTransform.sizeDelta = new Vector2 (821, 306);
SettlerInfoDelBg.transform.Translate (410, 152.5f, 0);
SettlerInfoDelBg.gameObject.SetActive (false);
SettlerInfoDelBg.CrossFadeAlpha (0.95f, 0, false);
//=======================\\
//=== Settler Picture ===\\
//=======================\\
settlerPortraitDel = (Image)Instantiate (settlerPortrait);
settlerPortraitDel.gameObject.transform.SetParent (myCanvas.gameObject.transform);
settlerPortraitDel.rectTransform.sizeDelta = new Vector2 (200, 300);
settlerPortraitDel.transform.Translate (105, 150, 0);
settlerPortraitDel.gameObject.SetActive (false);
//====================\\
//=== Settler Name ===\\
//====================\\
firstLastNameDel = (Text)Instantiate (firstLastName);
firstLastNameDel.gameObject.transform.SetParent (myCanvas.gameObject.transform);
firstLastNameDel.rectTransform.sizeDelta = new Vector2 (600, 50);
firstLastNameDel.transform.position = new Vector2 (500, 279);
firstLastNameDel.fontSize = 28;
firstLastNameDel.gameObject.SetActive (false);
//==========================\\
//=== Settler Attributes ===\\
//==========================\\
//Fake Attributes
rndHP = UnityEngine.Random.Range (1, 101);
rndStam = UnityEngine.Random.Range (0, 101);
rndMor = UnityEngine.Random.Range (0, 101);
rndHung = UnityEngine.Random.Range (0, 101);
rndThir = UnityEngine.Random.Range (0, 101);
rndStr = UnityEngine.Random.Range (0, 11);
rndInt = UnityEngine.Random.Range (0, 11);
rndAgil = UnityEngine.Random.Range (0, 11);
rndPerc = UnityEngine.Random.Range (0, 11);
rndChar = UnityEngine.Random.Range (0, 11);
// Attributes Title
attributesTitleDel = (Text)Instantiate (attributesTitle);
attributesTitleDel.gameObject.transform.SetParent (myCanvas.gameObject.transform);
attributesTitleDel.rectTransform.sizeDelta = new Vector2 (1920, 100);
attributesTitleDel.text = "Attributes";
attributesTitleDel.fontSize = 28;
attributesTitleDel.transform.position = new Vector2 (315, 230);
attributesTitleDel.rectTransform.sizeDelta = new Vector2 (200, 50);
attributesTitleDel.gameObject.SetActive (false);
//Health
settlerHealthImageDel = (Image)Instantiate (settlerHealthImage);
settlerHealthImageDel.gameObject.transform.SetParent (myCanvas.gameObject.transform);
settlerHealthImageDel.rectTransform.sizeDelta = new Vector2 (30, 30);
settlerHealthImageDel.transform.Translate (240, 177, 0);
settlerHealthImageDel.gameObject.SetActive (false);
//Text
settlerHealthTextDel = (Text)Instantiate (settlerHealthText);
settlerHealthTextDel.gameObject.transform.SetParent (myCanvas.gameObject.transform);
settlerHealthTextDel.rectTransform.sizeDelta = new Vector2 (300, 100);
settlerHealthTextDel.transform.position = new Vector2 (settlerHealthImageDel.rectTransform.position.x + 45, settlerHealthImageDel.rectTransform.position.y);
settlerHealthTextDel.gameObject.SetActive (false);
settlerHealthTextDel.fontSize = 18;
//Stamina
settlerStaminaImageDel = (Image)Instantiate (settlerStaminaImage);
//.........这里部分代码省略.........
示例7: SuccessfulCoroutine
IEnumerator SuccessfulCoroutine(Image prompt, Image ring)
{
prompt.CrossFadeAlpha(0, successfulScaleTime, true);
ring.canvasRenderer.SetAlpha(0);
for (var t = 0.0f; t < 1; t += Time.deltaTime / successfulScaleTime)
{
var v = Mathf.SmoothStep(1, 2, t);
prompt.rectTransform.localScale = new Vector3(v, v, 1);
yield return null;
}
}
示例8: FlashImage
IEnumerator FlashImage(Image img, int times)
{
yield return new WaitForSeconds(0.25f);
int i = 0;
while (i < times) {
img.CrossFadeAlpha(0.0f, 0.2f, false);
yield return new WaitForSeconds(0.2f);
img.CrossFadeAlpha(1.0f, 0.2f, false);
yield return new WaitForSeconds(0.2f);
i += 1;
}
}
示例9: Awake
void Awake()
{
// Initialize lap and checkpoint values
curLap = new int[2] {0, 0};
curCheckpoint = new int[2] {-1, -1};
curProgress = new int[2] {-1, -1};
boostProgress = new int[2] {0, 0};
checkpointCount = checkpointList.transform.childCount;
checkpointLogic = transform.Find("CheckpointLogic").gameObject;
// Get all the UI elements
redOverlay = transform.Find("UI/RedOverlay").gameObject.GetComponent<Image>();
blueOverlay = transform.Find("UI/BlueOverlay").gameObject.GetComponent<Image>();
redOverlay.enabled = true;
blueOverlay.enabled = true;
winnerCrown = transform.Find("UI/WinnerPanel/WinnerCrown").gameObject.GetComponent<WinnerCrownController>();
redLapPanel = transform.Find("UI/RedLapPanel").gameObject.GetComponent<Image>();
blueLapPanel = transform.Find("UI/BlueLapPanel").gameObject.GetComponent<Image>();
redLapText = transform.Find("UI/RedLapPanel/LapText").gameObject.GetComponent<Text>();
blueLapText = transform.Find("UI/BlueLapPanel/LapText").gameObject.GetComponent<Text>();
redCurrentLapText = transform.Find("UI/RedLapPanel/CurrentLapText").gameObject.GetComponent<Text>();
blueCurrentLapText = transform.Find("UI/BlueLapPanel/CurrentLapText").gameObject.GetComponent<Text>();
redLose = transform.Find("UI/RedLose").gameObject.GetComponent<Image>();
blueLose = transform.Find("UI/BlueLose").gameObject.GetComponent<Image>();
circleWipe = transform.Find("UI/CircleWipe").gameObject.GetComponent<CircleWipe>();
levelEnd = transform.Find("UI/LevelEnd").gameObject.GetComponent<RectTransform>();
levelEndText = levelEnd.gameObject.GetComponentsInChildren<Text>();
levelEnd.gameObject.SetActive(false);
redLose.enabled = true;
blueLose.enabled = true;
redLose.CrossFadeAlpha(0F, 0F, true);
blueLose.CrossFadeAlpha(0F, 0F, true);
audioLogic = transform.Find("AudioLogic").gameObject.GetComponent<AudioController>();
squids = transform.Find("Spawn").gameObject.GetComponentsInChildren<SquidController>();
cameras = transform.Find("Spawn").gameObject.GetComponentsInChildren<Camera>();
crossHairPlanes = transform.Find("UI/CrosshairPlanes").gameObject.GetComponentsInChildren<Image>();
crossHairs = transform.Find("UI/Crosshairs").gameObject.GetComponentsInChildren<Image>();
}
示例10: Start
//=================\\
//===== Start =====\\
//=================\\
void Start()
{
globalAttributes = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();
aSpawner = GameObject.Find("ASpawner").GetComponent<AgentSpawner>();
// === HUD Background ===\\
HUDDelBg = (Image)Instantiate (HUDBg);
HUDDelBg.gameObject.transform.SetParent (myCanvas.gameObject.transform);
HUDDelBg.rectTransform.sizeDelta = new Vector2 (960, 109);
HUDDelBg.transform.Translate (Screen.width / 2, Screen.height - 54.5f, 0);
HUDDelBg.CrossFadeAlpha (0.9f, 0, false);
//cursorTexture_default.Resize (9, 11);
Cursor.SetCursor(cursorTexture_default, hotSpot, CursorMode.Auto);
//===========================\\
// === GLOBAL ATTRIBUTES === \\
//===========================\\
//Scrap
scrapIconDel = (Image)Instantiate (scrapIcon);
scrapIconDel.gameObject.transform.SetParent (myCanvas.gameObject.transform);
scrapIconDel.rectTransform.sizeDelta = new Vector2 (90, 72);
scrapIconDel.transform.Translate (((HUDDelBg.gameObject.transform.position.x) - 30), Screen.height - 42.5f, 0);
//Text
scrapDelText = (Text)Instantiate (scrapText);
scrapDelText.gameObject.transform.SetParent (myCanvas.gameObject.transform);
scrapDelText.text = "";
scrapDelText.transform.position = new Vector2 (HUDDelBg.rectTransform.position.x + 42.5f, scrapIconDel.rectTransform.position.y);
scrapDelText.rectTransform.sizeDelta = new Vector2 (200, 50);
//Population
populationIconDel = (Image)Instantiate (populationIcon);
populationIconDel.gameObject.transform.SetParent (myCanvas.gameObject.transform);
populationIconDel.rectTransform.sizeDelta = new Vector2 (70, 70);
populationIconDel.transform.Translate (scrapIconDel.transform.position.x - 380, scrapIconDel.rectTransform.position.y - 25.5f, 0);
//Text
populationDelText = (Text)Instantiate (populationText);
populationDelText.gameObject.transform.SetParent (myCanvas.gameObject.transform);
populationDelText.text = "";
populationDelText.fontSize = 20;
populationDelText.transform.position = new Vector2 (populationIconDel.transform.position.x + 70, scrapDelText.transform.position.y - 25.5f);
//Power
powerIconDel = (Image)Instantiate (powerIcon);
powerIconDel.gameObject.transform.SetParent (myCanvas.gameObject.transform);
powerIconDel.rectTransform.sizeDelta = new Vector2 (100, 100);
powerIconDel.transform.Translate (populationIconDel.transform.position.x + 185, scrapIconDel.rectTransform.position.y - 25.5f, 0);
//Text
powerDelText = (Text)Instantiate (powerText);
powerDelText.gameObject.transform.SetParent (myCanvas.gameObject.transform);
powerDelText.text = "";
powerDelText.transform.position = new Vector2 (powerIconDel.transform.position.x + 70, scrapDelText.transform.position.y - 25.5f);
powerDelText.rectTransform.sizeDelta = new Vector2 (200, 50);
//Food
foodIconDel = (Image)Instantiate (foodIcon);
foodIconDel.gameObject.transform.SetParent (myCanvas.gameObject.transform);
foodIconDel.rectTransform.sizeDelta = new Vector2 (120, 120);
foodIconDel.transform.Translate (powerIconDel.transform.position.x + 390, scrapIconDel.rectTransform.position.y - 17.5f, 0);
//Text
foodDelText = (Text)Instantiate (foodText);
foodDelText.gameObject.transform.SetParent (myCanvas.gameObject.transform);
foodDelText.text = "";
foodDelText.transform.position = new Vector2 (foodIconDel.transform.position.x + 70, scrapDelText.transform.position.y - 25.5f);
foodDelText.rectTransform.sizeDelta = new Vector2 (100, 100);
//Water
waterIconDel = (Image)Instantiate (waterIcon);
waterIconDel.gameObject.transform.SetParent (myCanvas.gameObject.transform);
waterIconDel.rectTransform.sizeDelta = new Vector2 (100, 100);
waterIconDel.transform.Translate (foodIconDel.transform.position.x + 185, scrapIconDel.rectTransform.position.y - 20.5f, 0);
//Text
waterDelText = (Text)Instantiate (waterText);
waterDelText.gameObject.transform.SetParent (myCanvas.gameObject.transform);
waterDelText.text = "";
waterDelText.transform.position = new Vector2 (waterIconDel.transform.position.x + 70, scrapDelText.transform.position.y - 25.5f);
waterDelText.rectTransform.sizeDelta = new Vector2 (200, 50);
//===============\\
//=== BUTTONS ===\\
//===============\\
//.........这里部分代码省略.........