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")); }
void Start () { this.anim1 = this.conversante1.GetComponent<Animator> (); this.anim2 = this.conversante2.GetComponent<Animator> (); this.texto = GameObject.Find ("Dialogo").GetComponent<Text> (); TextAsset archivo = Resources.Load(this.fichero) as TextAsset; this.contenidoFichero = archivo.text; this.conversaciones = this.contenidoFichero.Split ('\n'); this.numConver = 0; this.primeraConversacion = true; this.siguienteConversacion = false; this.audioActual = this.gameObject.GetComponent<AudioSource> (); //Inicializamos el clip del audio. this.audioActual.clip = this.audio1; //Registramos la informacion del Analytics if (Tracker.T () != null) { this.registrarTracker (); } if (this.fichero == "Transicion1") this.anim2.SetBool("contenta", false); }
void Awake() { text = GameObject.Find("Info").GetComponent<Text>(); myCanvas = transform.parent.parent.parent.GetComponent<Canvas>(); infoMessage = new List<string>(); DisableMe(); }
void Awake() { Transform canvas = transform.Find("Canvas"); Group = canvas.GetComponent<CanvasGroup>(); Text = canvas.Find("Text").GetComponent<Text>(); Rigidbody = GetComponent<Rigidbody2D>(); }
// 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; } } }
// Use this for initialization void Start() { countdown = GameObject.Find("TrafficLight").GetComponent<Countdown>(); countdownText = GetComponent<Text>(); countdownText.text = "3"; countdownText.fontSize = fontSize; }
void Awake() { image = GetComponent<Image>(); button = GetComponent<Button>(); text = GetComponentInChildren<Text>(); References.stateManager.changeState += onChangeState; }
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); }
public void Start() { textElement = GetComponent<Text>(); unitTextElement = transform.Find("Unit").GetComponent<Text>(); textElement.gameObject.SetActive(target != null); EventManager.Instance.AddListener<Event_PlayerTargetChanged>(OnPlayerTargetChanged); }
void Start() { scoreLabelText = scoreLabel.GetComponent<Text>(); score = 0; UpdateScore (); StartCoroutine(SpawnWaves ()); }
// Use this for initialization void Start () { counter = -1; text = GetComponent<Text>(); text.text = "Mikey"; }
void OnInitEquippedWeapon(GameObject weapon) { textComponent = gameObject.GetComponent<Text>(); textComponent.text = weapon.GetComponent<Weapon>().title; textComponent.DOKill(); FadeInInitialTitle(); }
// 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> (); }
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"; } } }
/// <summary> /// Creates a new text dictionary based on a text file. /// </summary> /// <param name="textFile">The file to parse.</param> public TextDictionary(Text textFile) { dict = new Dictionary<string, Dictionary<string, string>>(); for (int i = 0; i < textFile.Length; i++) { //clean string int pound = textFile[i].IndexOf('#'); string s; if (pound >= 0) s = textFile[i].Substring(0, pound).Replace(" ", ""); else s = textFile[i].Replace(" ", ""); //get dot and equals locations int dot = s.IndexOf('.'); int set = s.IndexOf('='); if (dot == -1 || set == -1 || set < dot) continue; string first = s.Substring(0, dot); string second = s.Substring(dot + 1, set - dot - 1); string value = s.Substring(set + 1); if (!dict.ContainsKey(first)) dict[first] = new Dictionary<string, string>(); dict[first][second] = value; } cachedString = null; cachedDict = null; }
void Start() { upgradeText = gameObject.GetComponentInChildren<Text>(); setButtonText(); setInfoText(); setSprite(); }
void Start() { Application.runInBackground = true; client = new Client(PORT, "192.168.1.101"); client.Work(); sendMessage = forPrint; }
//Called when a level is loaded void OnLevelWasLoaded() { restartTimer = 0; totalMinutes = 0; playTimer = 0; GameOver = false; if (Application.loadedLevel == 1) { theSun = GameObject.Find("spotlight").GetComponent<Light>(); mHero = GameObject.Find("Hero").GetComponent<Hero>(); mTimer = GameObject.Find("Timer").GetComponent<Slider>(); mHBar = GameObject.Find("hpBar").GetComponent<Slider>(); mMin = GameObject.Find("minCounter").GetComponent<Text>(); mSec = GameObject.Find("secCounter").GetComponent<Text>(); Info = GameObject.Find("Info").GetComponent<Text>(); mPanel = GameObject.Find("Panel").GetComponent<Image>(); mPanel.gameObject.SetActive(false); Info.gameObject.SetActive(false); if(gameType == ENDLESS || gameType == DEBUG) { mTimer.gameObject.SetActive(false); } SpawnVariableControl(); StartCoroutine(MasterSpawner(Troll)); } else { SetButtons(); } }
void OnInitInteger(int initInt) { textComponent = gameObject.GetComponent<Text>(); textComponent.text = legend + initInt.ToString(); textComponent.DOKill(); FadeInText(); }
// Use this for initialization void Start() { inventoryTitle = transform.GetChild(0).GetComponent<Text>(); backgroundInventory = GetComponent<Image>(); backgroundSlot = transform.GetChild(1).GetChild(0).GetComponent<Image>(); amountSlot = getTextAmountOfItem(); }
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>(); }
// 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; }
// Use this for initialization void Start () { started = true; text = transform.GetChild (0).GetChild (0).GetComponent<Text> (); button = transform.GetChild (1); guid = Guid.NewGuid (); }
void Start() { _debugUI = GameObject.Find("DebugUI").GetComponent<DebugUI>(); _text = gameObject.GetComponent<Text>(); _canvasGroup = gameObject.GetComponent<CanvasGroup> (); _baseAlpha = 1f; }
// 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"); }
// 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; } }
// 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"); }
// Use this for initialization void Awake () { im = GetComponent<Image>(); txt = GetComponent<Text>(); i = text_sequence.Length; // Starts paused sngl = this; }
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; }
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); } } }
private void Awake() { skor = GameObject.FindGameObjectWithTag("Skor").GetComponent <Text>(); audioSource = GameObject.FindGameObjectWithTag("AudioScore").GetComponent <AudioSource>(); }
// Start is called before the first frame update void Start() { bloodText = gameObject.GetComponent <Text>(); PopulateBodyPartsList(); UpdateBloodText(); }
void OnEnable() { highscore = GetComponent <Text>(); highscore.text = "Highscore: " + PlayerPrefs.GetInt("Highscore").ToString(); }
// Use this for initialization void Start() { gameVersionText = GetComponent <Text> (); }
// Use this for initialization void Start() { text = GetComponent <Text>(); }
public float smothing = 1.0f; //用于显示和隐藏的插值运输 void Awake() { toolTipText = this.GetComponent <Text>(); contentText = this.transform.Find("Content").GetComponent <Text>(); toolTipCanvasGroup = this.GetComponent <CanvasGroup>(); }
private void Start() { magicPowerText = GetComponent<Text>(); displayUpdate(); }
private void Awake() { labelText = GetComponent <Text>(); }
// Use this for initialization void Start() { this.lastText = infoText.text; descripcion = panel.GetComponent <Text>(); protagonista = personaje.GetComponent <Animator>(); }
// Use this for initialization void Start() { text = GameObject.Find("Result").GetComponent <Text>(); }
void Awake() { text = GetComponent <Text> (); score = 0; }
// Text public static void SetAlpha(this Text t, float newAlpha) { Color c = t.color; t.color = new Color(c.r, c.g, c.b, newAlpha); }
private void Awake() { livesText = this.GetComponent<Text>(); }
private void Awake() { scoreText = transform.Find("ScoreText").GetComponent <Text>(); highscoreText = transform.Find("highscoreText").GetComponent <Text>(); }
void OnEnable() { text = GetComponent <Text>(); }
void Awake() { statusText = GetComponent <Text>(); }
// Use this for initialization void Start() { Disp = GameObject.Find("Text").GetComponent <Text>(); }
// Use this for initialization void Start() { _scoreUI = GetComponent <Text>(); }
void Start() { myText = GameObject.Find("Text20").GetComponent<Text>(); }
void Start() { message = GetComponent<Text>(); this.countdownText = transitionCountdown.GetComponent<UnityEngine.UI.Text>(); this.simScriptComp = simManager.GetComponent<SimManager>(); }
// HoteKey模块按钮单击事件 public void HotKeyBtnClick(GameObject btnObj) { mHotKeyIndex = int.Parse(btnObj.name); Text label = btnObj.GetComponentInChildren <Text>(); if (label) { LogMgr.UnityLog("hotkey: index[" + mHotKeyIndex + "]," + "name[" + mHotKeyMap[mHotKeyIndex].strName + "]," + "desc[" + mHotKeyMap[mHotKeyIndex].strDesc + "]"); } // 储存到显示Buff LogToBuff(DEBUG_TYPE.DEBUG_GM, LOG_TYPE.LOG_NULL, mHotKeyMap[mHotKeyIndex].strDesc); // 快捷按钮处理 mHotKeyBtn = btnObj.GetComponent <Button>(); mHotKeyLabel = btnObj.GetComponentInChildren <Text>(); switch (mHotKeyIndex) { case 0: OnWudi(); break; case 1: OnMiaoGuai(); break; case 2: OnTimeScale(); break; case 3: OnCancelAtuoFight(); break; case 4: OnShowSkillScope(); break; case 5: CoreEntry.gGameMgr.RenderMeshSwith(); break; //case 6: // CoreEntry.gGameMgr.RenderMeshSwith(); // break; case 6: OnWuShang(); break; case 7: OnRecordNet(); break; case 8: OnCommon(mGmMgr.SwitchSoundEffect); break; case 9: OnCommon(mGmMgr.SwitchAI); break; default: break; } }
void Start() { Transform transform = this.gameObject.transform.Find("GMPanel/SendBtn"); if (transform != null) { uGUI.UIEventListener.Get(transform.gameObject).onPointerClick = SendBtnClick; } transform = this.gameObject.transform.Find("GMPanel/CloseBtn"); if (transform != null) { uGUI.UIEventListener.Get(transform.gameObject).onPointerClick = CloseBtnClick; } transform = this.gameObject.transform.Find("GMPanel/LogClearBtn"); if (transform != null) { uGUI.UIEventListener.Get(transform.gameObject).onPointerClick = LogClearBtnClick; } transform = this.gameObject.transform.Find("GMPanel/TimeSet/btnSetTime"); if (transform != null) { uGUI.UIEventListener.Get(transform.gameObject).onPointerClick = OnBtnSetScaleTime; } transform = this.gameObject.transform.Find("GMPanel/InputField"); if (transform != null) { mInput = transform.GetComponent <InputField>(); } transform = this.gameObject.transform.Find("GMPanel/TimeSet/InputFieldTimeScale"); if (transform != null) { m_TimeScaleInput = transform.GetComponent <InputField>(); } transform = this.gameObject.transform.Find("GMPanel/OutPut"); if (transform != null) { mTextOutPut = transform.GetComponent <Text>(); } transform = this.gameObject.transform.Find("GMPanel/ProfilerBtn"); if (transform != null) { uGUI.UIEventListener.Get(transform.gameObject).onPointerClick = OnMemInfoBtnClick; } transform = this.gameObject.transform.Find("GMPanel/SwitchQualityBtn"); if (transform != null) { uGUI.UIEventListener.Get(transform.gameObject).onPointerClick = OnSwitchQualityBtnClick; } switchBtnText = this.gameObject.transform.Find("GMPanel/SwitchQualityBtn/Text").GetComponent <Text>(); RefreshSwitchBtnText(); // 初始化HotKey模块 InitHotKey(); }
// Start is called before the first frame update void Start() { score = GetComponent<Text>(); }
void Start() { currentSceneIndex = SceneManager.GetActiveScene().buildIndex; scoreText = GetComponent <Text>(); UpdateDisplay(); }
private void Awake() { startTime = Time.time; displayText = "\n\nTaking initial readings..."; this.text = this.GetComponent <Text>(); }
void Start() { text = GetComponent <Text>(); //自分のインスペクター内からTextコンポーネントを取得 }
public void CreateInterface(Question question) { // Setup Canvas game object. quizInterface = new GameObject("QuizInterface"); Canvas quizCanvas = quizInterface.AddComponent <Canvas>(); quizInterface.AddComponent <CanvasScaler>(); GvrPointerGraphicRaycaster quizRaycaster = quizInterface.AddComponent <GvrPointerGraphicRaycaster>(); quizInterface.transform.position = new Vector3(0, 0, 2.2f); quizInterface.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f); quizInterface.layer = 5; quizCanvas.GetComponent <RectTransform>().sizeDelta = new Vector2(1101, 567); quizCanvas.renderMode = RenderMode.WorldSpace; quizRaycaster.ignoreReversedGraphics = true; quizRaycaster.blockingObjects = GvrPointerGraphicRaycaster.BlockingObjects.ThreeD; // Setup Text game object. GameObject questionTextObject = new GameObject("QuestionText"); questionTextObject.AddComponent <CanvasRenderer>(); Text questionText = questionTextObject.AddComponent <Text>(); RectTransform questionTextRect = questionText.GetComponent <RectTransform>(); questionTextObject.transform.parent = quizInterface.transform; questionText.transform.localScale = new Vector3(1, 1, 1); questionTextRect.localPosition = new Vector3(0, 30, 0); questionTextRect.sizeDelta = new Vector2(160, 30); questionText.alignment = TextAnchor.MiddleCenter; questionText.font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font; questionText.color = Color.white; questionText.text = question.QuestionText; // Setup Button game objects. for (int index = 0; index < question.Answers.Count; index++) { int x = (index * 160) - ((question.Answers.Count - 1) * 160 / 2); int y = 0; GameObject answerButtonObject = new GameObject($"{question.Answers[index].AnswerText}Button"); answerButtonObject.AddComponent <CanvasRenderer>(); Image answerButtonImage = answerButtonObject.AddComponent <Image>(); answerButtonObject.AddComponent <Button>(); RectTransform answerButtonRect = answerButtonObject.GetComponent <RectTransform>(); VRButton answerVRButton = answerButtonObject.AddComponent <VRButton>(); EventTrigger answerEventTrigger = answerButtonObject.AddComponent <EventTrigger>(); //EventTrigger.Entry answerEventEntry = new EventTrigger.Entry(); answerButtonObject.transform.parent = quizInterface.transform; answerButtonObject.transform.localScale = new Vector3(1, 1, 1); answerButtonRect.localPosition = new Vector3(x, -50 + y, 0); answerButtonRect.sizeDelta = new Vector2(160, 30); answerButtonImage.sprite = UnityEditor.AssetDatabase.GetBuiltinExtraResource <Sprite>("UI/Skin/UISprite.psd"); answerButtonImage.type = Image.Type.Sliced; answerVRButton.cursor = GameObject.Find("HoverReticle").GetComponent <Image>(); //answerEventEntry.eventID = EventTriggerType.PointerEnter; //answerEventEntry.callback.AddListener(new UnityAction<BaseEventData>((eventData) => { answerVRButton.GVROn(); })); answerEventTrigger.AddListener(EventTriggerType.PointerEnter, (PointerEventData eventData) => { answerVRButton.GVROn(); }); GameObject answerTextObject = new GameObject($"{question.Answers[index].AnswerText}ButtonText"); answerTextObject.AddComponent <CanvasRenderer>(); Text answerText = answerTextObject.AddComponent <Text>(); RectTransform answerTextRect = answerText.GetComponent <RectTransform>(); answerTextObject.transform.parent = answerButtonObject.transform; answerText.transform.localScale = new Vector3(1, 1, 1); answerTextRect.anchorMin = new Vector2(0, 0); answerTextRect.anchorMax = new Vector2(1, 1); answerTextRect.localPosition = new Vector3(0, 0, 0); answerTextRect.sizeDelta = new Vector2(0, 0); answerText.text = question.QuestionText; answerText.alignment = TextAnchor.MiddleCenter; answerText.font = Resources.GetBuiltinResource(typeof(Font), "Arial.ttf") as Font; answerText.color = Color.black; answerText.text = question.Answers[index].AnswerText; } }
// Update is called once per frame void Update() { Text text = GetComponent <Text>(); text.text = GameState.Level.ToString(); }
void Start() { countDownText = GameObject.FindWithTag("countdown").GetComponent <Text>(); }
private void Update() { numFrames++; if (Time.time > nextOutputTime) { // time to display the results // column width for text display int colWidth = 20; // the overall frame time and frames per second: displayText = "\n\n"; float totalMS = (Time.time - startTime) * 1000; float avgMS = (totalMS / numFrames); float fps = (1000 / (totalMS / numFrames)); displayText += "Avg frame time: "; displayText += avgMS.ToString("0.#") + "ms, "; displayText += fps.ToString("0.#") + " fps \n"; // the column titles for the individual recordings: displayText += "Total".PadRight(colWidth); displayText += "MS/frame".PadRight(colWidth); displayText += "Calls/fra".PadRight(colWidth); displayText += "MS/call".PadRight(colWidth); displayText += "Label"; displayText += "\n"; // now we loop through each individual recording foreach (var entry in recordings) { // Each "entry" is a key-value pair where the string ID // is the key, and the recording instance is the value: ProfilerRecording recording = entry.Value; // calculate the statistics for this recording: float recordedMS = (recording.Seconds * 1000); float percent = (recordedMS * 100) / totalMS; float msPerFrame = recordedMS / numFrames; float msPerCall = recordedMS / recording.Count; float timesPerFrame = recording.Count / (float)numFrames; // add the stats to the display text displayText += (percent.ToString("0.000") + "%").PadRight(colWidth); displayText += (msPerFrame.ToString("0.000") + "ms").PadRight(colWidth); displayText += (timesPerFrame.ToString("0.000")).PadRight(colWidth); displayText += (msPerCall.ToString("0.0000") + "ms").PadRight(colWidth); displayText += (recording.id); displayText += "\n"; // and reset the recording recording.Reset(); } //Debug.Log(displayText); this.text.text = displayText; // reset & schedule the next time to display results: numFrames = 0; startTime = Time.time; nextOutputTime = Time.time + 5; } }