本文整理汇总了C#中Text类的典型用法代码示例。如果您正苦于以下问题:C# Text类的具体用法?C# Text怎么用?C# Text使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Text类属于命名空间,在下文中一共展示了Text类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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"));
}
开发者ID:perfectdaemon,项目名称:ragdoll-arena,代码行数:26,代码来源:WeaponController.cs
示例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;
}
}
}
开发者ID:khinbaptista,项目名称:GameJam2015,代码行数:35,代码来源:TextVerifierScript.cs
示例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");
}
开发者ID:etang4,项目名称:CSE_494,代码行数:8,代码来源:EarthLevelScript.cs
示例4: Start
void Start()
{
scoreLabelText = scoreLabel.GetComponent<Text>();
score = 0;
UpdateScore ();
StartCoroutine(SpawnWaves ());
}
开发者ID:dimitardanailov,项目名称:space-shooter-tutorial,代码行数:7,代码来源:GameController.cs
示例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);
}
开发者ID:ZachPhillipsGary,项目名称:PereyraIS,代码行数:29,代码来源:DebugPanelField.cs
示例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";
}
}
}
开发者ID:sandra-laduranti,项目名称:psar,代码行数:60,代码来源:VerifButton.cs
示例7: OnInitEquippedWeapon
void OnInitEquippedWeapon(GameObject weapon)
{
textComponent = gameObject.GetComponent<Text>();
textComponent.text = weapon.GetComponent<Weapon>().title;
textComponent.DOKill();
FadeInInitialTitle();
}
开发者ID:hftamayo,项目名称:Unity2D-Components,代码行数:7,代码来源:DisplayWeaponTitle.cs
示例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 ();
}
开发者ID:lmlynik,项目名称:cardgame,代码行数:8,代码来源:TextPanelBehaviour.cs
示例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);
}
}
}
开发者ID:danielkropf,项目名称:The-RPG,代码行数:25,代码来源:Battle.cs
示例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");
}
开发者ID:shirhxio,项目名称:SQUARE_PUZZLE,代码行数:36,代码来源:PuzzleArea.cs
示例11: Start
void Start()
{
_debugUI = GameObject.Find("DebugUI").GetComponent<DebugUI>();
_text = gameObject.GetComponent<Text>();
_canvasGroup = gameObject.GetComponent<CanvasGroup> ();
_baseAlpha = 1f;
}
开发者ID:EpicPants90,项目名称:ELB,代码行数:7,代码来源:DebugText.cs
示例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; }
}
开发者ID:ytchang,项目名称:Color-run,代码行数:8,代码来源:level1Tutorial.cs
示例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;
}
开发者ID:tswierkot,项目名称:EloBuddy,代码行数:7,代码来源:Events.cs
示例14: Awake
// Use this for initialization
void Awake () {
im = GetComponent<Image>();
txt = GetComponent<Text>();
i = text_sequence.Length; // Starts paused
sngl = this;
}
开发者ID:thk123,项目名称:WizardsRitual,代码行数:8,代码来源:Countdown.cs
示例15: Start
void Start()
{
upgradeText = gameObject.GetComponentInChildren<Text>();
setButtonText();
setInfoText();
setSprite();
}
开发者ID:RommelLayco,项目名称:pirate-game-project,代码行数:7,代码来源:UpgradeSailsRoom.cs
示例16: Start
void Start ()
{
// 各アビリティボタンの親であるMaskをアタッチしているオブジェクトを取得
attackParentGO = GameObject.Find("Tab_Action").transform.FindChild("Mask").gameObject;
defenceParentGO = GameObject.Find("Tab_Support").transform.FindChild("Mask").gameObject;
reactionParentGO = GameObject.Find("Tab_Reaction").transform.FindChild("Mask").gameObject;
moveParentGO = GameObject.Find("Tab_Move").transform.FindChild("Mask").gameObject;
// 初期化としてアタックタブをアクティブ化、それ以外のタブを非アクティブ化する
attackParentGO.SetActive(true);
defenceParentGO.SetActive(false);
reactionParentGO.SetActive(false);
moveParentGO.SetActive(false);
// 非アクティブタブのテキスト文字色変更のためタブのテキストコンポを取得
attackTabTextCompo = GameObject.Find("Tab_Action").transform.FindChild("Text").GetComponent<Text>();
defenceTabTextCompo = GameObject.Find("Tab_Support").transform.FindChild("Text").GetComponent<Text>();
reactionTabTextCompo = GameObject.Find("Tab_Reaction").transform.FindChild("Text").GetComponent<Text>();
moveTabTextCompo = GameObject.Find("Tab_Move").transform.FindChild("Text").GetComponent<Text>();
// 初期化としてアタックタブ以外を灰色にする
attackTabTextCompo.color = new Color(255, 255, 255);
defenceTabTextCompo.color = Color.grey;
reactionTabTextCompo.color = Color.grey;
moveTabTextCompo.color = Color.grey;
// オーディオコンポを取得
audioCompo = GameObject.Find("PlayersParent").transform.FindChild("SEPlayer").gameObject.GetComponent<AudioSource>();
// TODO 本当はリクワイヤードコンポ属性を使うべき。上手く動いてくれなかったのでとりあえず
if (null == audioCompo) audioCompo = GameObject.Find("PlayersParent").transform.FindChild("SEPlayer").gameObject.GetComponent<AudioSource>();
}
开发者ID:yagamiiori,项目名称:UBTProject,代码行数:30,代码来源:AbilityTabActiveSelfChanger.cs
示例17: Start
// Use this for initialization
void Start () {
counterText = GetComponent<Text>() as Text;
set_seconds = maxSeconds;
seconds = set_seconds;
healthScript = healthObject.GetComponent<Health>();
musicManager = canvas.GetComponent<MusicManager> ();
}
开发者ID:CRRDerek,项目名称:Unity-First-Person-Shooter,代码行数:8,代码来源:Counter.cs
示例18: Awake
// Use this for initialization
void Awake ()
{
if (!sceneController)
sceneController = FindObjectOfType<SceneController>();
if (!generationValueLabel)
generationValueLabel = FindTextComponent("GenerationValue");
if (!waveNoValueLabel)
waveNoValueLabel = FindTextComponent("WaveNoValue");
if (!spawnNoValueLabel)
spawnNoValueLabel = FindTextComponent("SpawnNoValue");
if (!highestFitnessValueLabel)
highestFitnessValueLabel = FindTextComponent("HighestFitnessValue");
if (!solutionsValueLabel)
solutionsValueLabel = FindTextComponent("SolutionsValue");
if (!remainingEnemiesValueLabel)
remainingEnemiesValueLabel = FindTextComponent("RemainingEnemiesValue");
if (!sceneStateValueLabel)
sceneStateValueLabel = FindTextComponent("SceneStateValue");
if (!autoEvolveToggle)
autoEvolveToggle = GameObject.Find("AutoEvolveCheck").GetComponent<Toggle>();
autoEvolveToggle.isOn = sceneController.AutoEvolve;
}
开发者ID:Richy321,项目名称:TowerDefenseSolver,代码行数:31,代码来源:GA_GuiHandler.cs
示例19: Start
// Use this for initialization
void Start ()
{
counter = -1;
text = GetComponent<Text>();
text.text = "Mikey";
}
开发者ID:keyward,项目名称:Zombie-Prototype,代码行数:8,代码来源:names_Mikey.cs
示例20: OnInitInteger
void OnInitInteger(int initInt)
{
textComponent = gameObject.GetComponent<Text>();
textComponent.text = legend + initInt.ToString();
textComponent.DOKill();
FadeInText();
}
开发者ID:BrodyMedia,项目名称:Unity2D-Components,代码行数:7,代码来源:DisplayXP.cs
注:本文中的Text类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论