本文整理汇总了C#中Text类的典型用法代码示例。如果您正苦于以下问题:C# Text类的具体用法?C# Text怎么用?C# Text使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Text类属于命名空间,在下文中一共展示了Text类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCollisionWithEnemy
protected void OnCollisionWithEnemy(GameObject enemy, float power)
{
power *= WeaponPowerMiltiplier;
enemyTransform = enemy.transform;
enemyController = enemy.GetComponent<FightEnemyController>();
if (power < MinForceToHit)
return;
// Blood
newBloodParticle = Instantiate<GameObject>(BloodParticles);
newBloodParticle.transform.position = enemyTransform.position;
newBloodParticle.transform.up = (enemyTransform.position - selfTransform.position).normalized;
Destroy(newBloodParticle, 1);
// Do damage
enemyController.DoDamage(Mathf.Clamp(power, MinForceToHit, MaxForceToHit));
//print(WeaponTypeName + ": " + hitVelocityMagnitude.ToString());
// Damage Text
newDamageText = Instantiate<GameObject>(DamageText);
newDamageTextText = newDamageText.GetComponent<Text>();
newDamageTextText.rectTransform.SetParent(WorldCanvas, false);
newDamageTextText.rectTransform.position = enemyTransform.position + new Vector3(0f, 0.5f, 0f); ;
newDamageTextText.text = string.Format("{0}", power.ToString("F0"));
}
示例2: Start
// Use this for initialization
void Start()
{
savior = GameObject.Find("Savior");
toSave = GameObject.Find("ToSave");
identifier = GameObject.Find("Speech2").GetComponentInChildren<IdentifierScript>();
foreach (Text texto in GetComponentsInChildren<Text>())
{
Debug.Log("start");
switch (texto.name)
{
case "SaviorLastText":
scriptSaviorLast = texto.GetComponent<Text>().GetComponent<TextTyperScript>();
saviorLast = texto;
break;
case "SaviorText1":
scriptSavior1 = texto.GetComponent<Text>().GetComponent<TextTyperScript>();
savior1 = texto;
break;
case "SaviorText2":
scriptSavior2 = texto.GetComponent<Text>().GetComponent<TextTyperScript>();
savior2 = texto;
break;
case "ToSaveText1":
scriptToSave1 = texto.GetComponent<Text>().GetComponent<TextTyperScript>();
toSave1 = texto;
break;
case "ToSaveText2":
scriptToSave2 = texto.GetComponent<Text>().GetComponent<TextTyperScript>();
toSave2 = texto;
break;
}
}
}
示例3: Start
// Use this for initialization
void Start()
{
textPanelText = DialogPanel.transform.GetChild(1).GetComponent<Text>();
NPCTalkingTitle = DialogPanel.transform.GetChild(0).GetComponent<Text>();
sizeOfTextPanels = textPanels.Length;
PlayerPrefs.SetString("EnteringPlanet", "None");
}
示例4: Start
void Start()
{
scoreLabelText = scoreLabel.GetComponent<Text>();
score = 0;
UpdateScore ();
StartCoroutine(SpawnWaves ());
}
示例5: Start
void Start()
{
HorizontalLayoutGroup hLayout = gameObject.AddComponent<HorizontalLayoutGroup> ();
hLayout.padding = new RectOffset (5, 5, 0, 0);
hLayout.childForceExpandHeight = false;
hLayout.childForceExpandWidth = false;
hLayout.transform.localScale = new Vector3 (1, 1, 1);
//
titleT = (new GameObject ()).AddComponent<Text> ();
titleT.transform.SetParent(transform);
titleT.name = "Title";
titleT.color = color;
titleT.font = DebugPanelViewport.arial;
titleT.text = name;
titleT.fontStyle = FontStyle.Bold;
titleT.fontSize = 14;
titleT.transform.localScale = new Vector3 (1, 1, 1);
//
LayoutElement lElement = titleT.gameObject.AddComponent<LayoutElement> ();
lElement.minWidth = 100;
//
valueT = (new GameObject ()).AddComponent<Text> ();
valueT.transform.SetParent(transform);
valueT.name = "Value";
valueT.color = color;
valueT.fontSize = 14;
valueT.font = DebugPanelViewport.arial;
valueT.transform.localScale = new Vector3 (1, 1, 1);
}
示例6: VerifFormule
public void VerifFormule()
{
Jardin jardin = terrainHandler.getJardin();
Communicate comm = new Communicate(SCRIPT_PYTHON, jardin);
//lance le script
comm.GetSource().Execute(comm.GetScope());
for (int i = 1; i <= NB_FORMULE; i++)
{
iField = (InputField)GameObject.Find(PATH + "Form_" + i).GetComponent<InputField>();
output = (Text)GameObject.Find(PATH + "VerifPan_" + i + "/verif_resultat_" + i).GetComponent<Text>();
if (iField.text == "")
{
continue;
}
try
{
Formule formule = FormuleFactory.parse(iField.text);
foreach (Element el in jardin.GetElements())
{
Debug.Log(el);
}
object pythonForm = comm.HandleForm(formule);
Func<Jardin, object> unity_my_interp_formul = comm.GetScope().GetVariable<Func<Jardin, object>>("unity_my_interp_formul");
object pythonJardin = unity_my_interp_formul(jardin);
Func<object, object, object> unity_eval_one_form = comm.GetScope().GetVariable<Func<object, object, object>>("unity_eval_one_form");
var res = unity_eval_one_form(pythonJardin, pythonForm);
//Affiche résultat
if ((bool)res == true)
{
output.color = Color.green;
output.text = "Vrai";
}
else
{
output.color = Color.red;
output.text = "Faux";
}
}
catch (ParserLogException)
{
output.color = Color.red;
output.text = "Erreur";
Debug.Log("Erreur formule");
}
catch (ValueErrorException)
{
output.color = new Color32(255, 128, 0, 255);
output.text = "Var libre";
}
catch (Exception)
{
output.color = Color.red;
output.text = "Erreur imprévue";
}
}
}
示例7: OnInitEquippedWeapon
void OnInitEquippedWeapon(GameObject weapon)
{
textComponent = gameObject.GetComponent<Text>();
textComponent.text = weapon.GetComponent<Weapon>().title;
textComponent.DOKill();
FadeInInitialTitle();
}
示例8: Start
// Use this for initialization
void Start ()
{
started = true;
text = transform.GetChild (0).GetChild (0).GetComponent<Text> ();
button = transform.GetChild (1);
guid = Guid.NewGuid ();
}
示例9: EnemyAttack
void EnemyAttack()
{
if (tw.ce.enemySummoned) {
if (whoMoves == 1) {
txt = damageTakenPlayer.GetComponent<Text>();
dice = Random.Range(1, 21);
diceDef = Random.Range(1, 5);
if (dice > (tw.tst.dexTotal + diceDef)) {
dice = Random.Range(1, 5);
dmg = dice + tw.ce.enemySTR - (tw.tst.conTotal / 2);
sld = playerLife.GetComponent<Slider>();
sld.value -= dmg;
txt.text = dmg.ToString();
dmg = 0;
whoMoves = 0;
} else {
txt.text = "MISS";
whoMoves = 0;
}
damageTakenEnemy.SetActive(false);
damageTakenPlayer.SetActive(true);
}
}
}
示例10: Start
// Use this for initialization
void Start () {
sys = GameObject.Find ("Systems");
sysPrp = sys.GetComponent<Systems> ();
sysPrp.gameClearFlag = false;
totalScoreBuff = 100;
for (int i = 0; i < partySize; i++) {
totalScoreBuff += partyMember[i].GetComponent<CharaPanel>().scoreBuff;
}
for (int i = 0; i < numOfType; i++) {
totalPanelBuff [i] = 100;
for (int j = 0; j < partySize; j++) {
totalPanelBuff [i] += partyMember [j].GetComponent<CharaPanel> ().panelBuff [i];
}
}
currentScore = 0;
scoreText = scoreObj.GetComponent<Text> ();
scoreText.text = currentScore.ToString ("###0");
for (int i = 0; i < numOfType; i++) {
currentPanelScore [i] = 0;
panelScoreText[i] = panelScoreObj[i].GetComponent<Text>();
panelScoreText[i].text = currentPanelScore[i].ToString("###0");
}
countdownObj.SetActive (true);
countdownText = countdownObj.GetComponent<Text> ();
timerText = timer.GetComponent<Text> ();
timerText.text = timeLimit.ToString("#0.0");
for(int i = 0; i < 2; i++){
touchedPanel[i] = dummyPanel;
}
SetArray (0, 0, panel_Row - 1, panel_Column - 1);
StartCoroutine("CountDown");
}
示例11: Start
void Start()
{
_debugUI = GameObject.Find("DebugUI").GetComponent<DebugUI>();
_text = gameObject.GetComponent<Text>();
_canvasGroup = gameObject.GetComponent<CanvasGroup> ();
_baseAlpha = 1f;
}
示例12: Start
// Use this for initialization
void Start () {
CueLevels.dialog.SetActive(true);
dialogTxt = CueLevels.dialog.GetComponentInChildren<Text>();
dialogTxt.text = "Press Space to jump";
Index = 1;
if (CueLevels.retrying == true) { dialogTxt.text = "Jump and start!"; Index = 4; }
}
示例13: Events
static Events()
{
Text = new Text("", new Font(FontFamily.GenericSansSerif, 12, FontStyle.Bold)) { Color = System.Drawing.Color.ForestGreen };
Orbwalker.OnPostAttack += OrbwalkerOnOnPostAttack;
Obj_AI_Base.OnLevelUp += Obj_AI_Base_OnOnLevelUp;
Drawing.OnDraw += OnDraw;
}
示例14: Awake
// Use this for initialization
void Awake () {
im = GetComponent<Image>();
txt = GetComponent<Text>();
i = text_sequence.Length; // Starts paused
sngl = this;
}
示例15: Start
void Start()
{
upgradeText = gameObject.GetComponentInChildren<Text>();
setButtonText();
setInfoText();
setSprite();
}