当前位置: 首页>>代码示例>>C#>>正文


C# TextMesh.GetComponent方法代码示例

本文整理汇总了C#中UnityEngine.TextMesh.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# TextMesh.GetComponent方法的具体用法?C# TextMesh.GetComponent怎么用?C# TextMesh.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.TextMesh的用法示例。


在下文中一共展示了TextMesh.GetComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

	//*************************************************************//
	void Start () 
	{
		_timeText = transform.Find ( "textTime" ).GetComponent < TextMesh > ();
		_nameText = transform.Find ( "textName" ).GetComponent < TextMesh > ();
		
		_myElement01Material = transform.Find ( "element01" ).renderer.material;
		_myElement02Material = transform.Find ( "element02" ).renderer.material;
		_myElement03Material = transform.Find ( "element03" ).renderer.material;
		
		_element01HavingText = transform.Find ( "element01" ).Find ( "textNumberYouHave" ).GetComponent < TextMesh > ();
		_element02HavingText = transform.Find ( "element02" ).Find ( "textNumberYouHave" ).GetComponent < TextMesh > ();
		_element03HavingText = transform.Find ( "element03" ).Find ( "textNumberYouHave" ).GetComponent < TextMesh > ();
		
		_element01RequiredText = transform.Find ( "element01" ).Find ( "textNumberRequeired" ).GetComponent < TextMesh > ();
		_element02RequiredText = transform.Find ( "element02" ).Find ( "textNumberRequeired" ).GetComponent < TextMesh > ();
		_element03RequiredText = transform.Find ( "element03" ).Find ( "textNumberRequeired" ).GetComponent < TextMesh > ();
		
		_myElement01Material.mainTexture = FLLevelControl.getInstance ().gameElements[GameElements.ICON_METAL];
		_myElement02Material.mainTexture = FLLevelControl.getInstance ().gameElements[GameElements.ICON_PLASTIC];
		_myElement03Material.mainTexture = FLLevelControl.getInstance ().gameElements[GameElements.ICON_VINES];
		
		switch ( myElementID )
		{
			case GameElements.ICON_RECHARGEOCORES:
				_nameText.GetComponent < GameTextControl > ().myKey = "ui_name_factory_storage_rechargeocores";
				break;
			case GameElements.ICON_REDIRECTORS:
				_nameText.GetComponent < GameTextControl > ().myKey = "ui_name_factory_storage_redirectors";
				break;
		}
	}
开发者ID:rtumelty,项目名称:toyrescuestory,代码行数:32,代码来源:FL_MOMToolTipControl.cs

示例2: Start

 void Start()
 {
     t = GetComponent<TextMesh>();
     Color c = t.GetComponent<Renderer>().material.GetColor("_Color");
     Color withAlpha = new Color(c.r, c.g, c.b, alpha);
     t.GetComponent<Renderer>().material.SetColor("_Color", withAlpha);
 }
开发者ID:AnonymousRandomPerson,项目名称:Rangers,代码行数:7,代码来源:Credit.cs

示例3: StartShowMessage

	IEnumerator StartShowMessage (TextMesh textMesh, string message)
	{
		textMesh.text = message;
		textMesh.GetComponent<Renderer>().enabled = true;
		yield return new WaitForSeconds(visibleTime);
		textMesh.GetComponent<Renderer>().enabled = false;
	}
开发者ID:sonxoans2,项目名称:CoThu,代码行数:7,代码来源:ProfileMessenger.cs

示例4: init

	public void init (FightScreen fightScreen, PotionBag potionBag) {
		this.fightScreen = fightScreen;
		this.potionBag = potionBag;
		location = GameObject.FindGameObjectWithTag("LocationScreen").GetComponent<Location>();
		render = transform.Find("WinImage").GetComponent<SpriteRenderer>();
		bg = transform.Find("BG");
		valuesHolder = transform.Find("ValuesHolder");
//		rankPointsValue = valuesHolder.Find("RankPointsValue").GetComponent<TextMesh>();
		goldValue = valuesHolder.Find("GoldValue").GetComponent<TextMesh>();
		newLevelLabel = valuesHolder.Find("NewLevelLabel").GetComponent<TextMesh>();

//		MeshRenderer mesh = valuesHolder.Find("RankPointsLabel").GetComponent<MeshRenderer>();
//		mesh.sortingLayerName = "FightResultLayer";
//		mesh.sortingOrder = 2;
		MeshRenderer mesh = valuesHolder.Find("GoldLabel").GetComponent<MeshRenderer>();
		mesh.sortingLayerName = "FightResultLayer";
		mesh.sortingOrder = 2;
//		mesh = rankPointsValue.GetComponent<MeshRenderer>();
//		mesh.sortingLayerName = "FightResultLayer";
//		mesh.sortingOrder = 2;
		mesh = goldValue.GetComponent<MeshRenderer>();
		mesh.sortingLayerName = "FightResultLayer";
		mesh.sortingOrder = 2;
		mesh = newLevelLabel.GetComponent<MeshRenderer>();
		mesh.sortingLayerName = "FightResultLayer";
		mesh.sortingOrder = 2;

		newLevelLabel.gameObject.SetActive(false);
		valuesHolder.gameObject.SetActive(false);

		transform.Find("ClickText").GetComponent<StrokeText>().init("FightResultLayer", 10);
		gameObject.SetActive(false);
	}
开发者ID:aintech,项目名称:Heroes_of_Routine,代码行数:33,代码来源:FightResultScreen.cs

示例5: SetTextOnMesh

    public static void SetTextOnMesh(string text, TextMesh mesh, float boundary)
    {
        //TODO: This is rather naive. Hyphenation?
        text = text.Replace(System.Environment.NewLine, "");
        string[] words = text.Split(' ');

        var sb = new StringBuilder();
        var renderer = mesh.GetComponent<Renderer>();

        for (int i = 0; i < words.Length; i++)
        {
            sb.Append(words[i] + " ");
            mesh.text = sb.ToString();

            if (renderer.bounds.size.x >= boundary && i!=0)
            {
                //TODO: This crashes on first word. why +2 anyway?
                sb.Remove(sb.Length - (words[i].Length + 1), words[i].Length + 1);
                sb.Append(System.Environment.NewLine);
                sb.Append(words[i] + " ");
            }
        }
        sb.Remove(sb.Length - 1, 1);

        mesh.text = sb.ToString();
    }
开发者ID:NemoNessuno,项目名称:Opia,代码行数:26,代码来源:TypeSettingHelper.cs

示例6: Start

        void Start()
        {
            if (SpawnType == 0)
            {
                //Debug.Log("Spawning TextMesh Pro Objects.");
                // TextMesh Pro Implementation
                m_textMeshPro = m_floatingText.AddComponent<TextMeshPro>();
                //m_textMeshPro.FontAsset = Resources.Load("Fonts & Materials/JOKERMAN SDF", typeof(TextMeshProFont)) as TextMeshProFont; // User should only provide a string to the resource.
                //m_textMeshPro.anchor = AnchorPositions.Bottom;
                m_textMeshPro.color = new Color32((byte)Random.Range(0, 255), (byte)Random.Range(0, 255), (byte)Random.Range(0, 255), 255);
                m_textMeshPro.fontSize = 16;
                m_textMeshPro.text = string.Empty;

                StartCoroutine(DisplayTextMeshProFloatingText());
            }
            else
            {
                //Debug.Log("Spawning TextMesh Objects.");

                m_textMesh = m_floatingText.AddComponent<TextMesh>();
                m_textMesh.font = Resources.Load("Fonts/ARIAL", typeof(Font)) as Font; // User should only provide a string to the resource.     
                m_textMesh.GetComponent<Renderer>().sharedMaterial = m_textMesh.font.material;
                m_textMesh.color = new Color32((byte)Random.Range(0, 255), (byte)Random.Range(0, 255), (byte)Random.Range(0, 255), 255);
                m_textMesh.anchor = TextAnchor.LowerCenter;
                m_textMesh.fontSize = 16;

                StartCoroutine(DisplayTextMeshFloatingText());
            }

        }
开发者ID:Reticulatas,项目名称:Embargo,代码行数:30,代码来源:FloatingText.cs

示例7: Start

    void Start()
    {
        player = GameObject.Find("Character");
        background = GameObject.Find("Background");
        status = GameObject.Find("Level Complete").GetComponent<TextMesh>();
        stars_empty = new GameObject[3];
        stars_empty[0] = GameObject.Find("Star1");
        stars_empty[1] = GameObject.Find("Star2");
        stars_empty[2] = GameObject.Find("Star3");
        stars_full = new GameObject[3];
        stars_full[0] = GameObject.Find("StarColored1");
        stars_full[1] = GameObject.Find("StarColored2");
        stars_full[2] = GameObject.Find("StarColored3");
        recNotice = GameObject.Find("Loops").GetComponent<TextMesh>();
        background.GetComponent<SpriteRenderer>().enabled = false;
        status.GetComponent<MeshRenderer>().enabled = false;
        retry = GameObject.Find("Retry");
        mainMenu = GameObject.Find("Main Menu");
        nextLevel = GameObject.Find("Next Level");
        collectible = GameObject.Find("Collectible");

        for (int i = 0; i < stars_empty.Length; i++)
        {
            stars_empty[i].GetComponent<SpriteRenderer>().enabled = false;
            //print(stars_empty[i].GetComponent<SpriteRenderer>().enabled);
            stars_full[i].GetComponent<SpriteRenderer>().enabled = false;
            //print(stars_full[i].GetComponent<SpriteRenderer>().enabled);
        }
        retry.SetActive(false);
        mainMenu.SetActive(false);
        nextLevel.SetActive(false);

        this.GetComponent<Rigidbody2D>().velocity = new Vector2(speed, 0);
    }
开发者ID:thenewjeva,项目名称:Recursion,代码行数:34,代码来源:GameManager.cs

示例8: TextSize

 public TextSize(TextMesh tm)
 {
     textMesh = tm;
     renderer = tm.GetComponent<Renderer>();
     dict = new Hashtable();
     getSpace();
 }
开发者ID:ShadowVision,项目名称:FOX,代码行数:7,代码来源:TextSize.cs

示例9: Init

    public virtual void Init(Grid grid, int x, int y, float scale = 1, Sprite asset = null)
    {
        sfx = AudioManager.instance;

        container = transform.Find("Sprites");
        outline = transform.Find("Sprites/Outline").GetComponent<SpriteRenderer>();
        img = transform.Find("Sprites/Sprite").GetComponent<SpriteRenderer>();
        shadow = transform.Find("Sprites/Shadow").GetComponent<SpriteRenderer>();
        shadow.gameObject.SetActive(false);

        label = transform.Find("Label").GetComponent<TextMesh>();
        label.GetComponent<Renderer>().sortingLayerName = "Ui";
        label.gameObject.SetActive(Debug.isDebugBuild);

        this.grid = grid;
        this.x = x;
        this.y = y;
        this.asset = asset;

        this.walkable = true;

        transform.localPosition = new Vector3(x, y, 0);

        SetAsset(asset);
        SetImages(scale, Vector3.zero, 0);
        SetSortingOrder(0);

        visible = false;
        explored = false;
    }
开发者ID:snaptothegrid,项目名称:Tiler,代码行数:30,代码来源:Tile.cs

示例10: init

	private void init () {
		render = GetComponent<SpriteRenderer>();
		col = GetComponent<Collider2D>();
		text = GetComponentInChildren<TextMesh>();
		holder = transform.parent.GetComponent<ButtonHolder>();
		textRender = text.GetComponent<MeshRenderer>();
		textRender.sortingLayerName = render.sortingLayerName;
		textRender.sortingOrder = render.sortingOrder + 1;
	}
开发者ID:aintech,项目名称:Heroes_of_Routine,代码行数:9,代码来源:Button.cs

示例11: Start

    // Use this for initialization
    void Start()
    {
        EventController.Instance.Subscribe("MissionObjectDestroyed", this);
        _hideRendererTimer = new Timer {Duration = 1.5f};
        _hideRendererTimer.OnTick += OnHideRendererTimer;

        mText = GetComponent<TextMesh>();
        mText.GetComponent<Renderer>().enabled = false;
    }
开发者ID:ifty420,项目名称:Fly-Airplane-F18-Jets,代码行数:10,代码来源:TankDestroyedText.cs

示例12: init

    public override void init(EquipmentScreen equipmentScreen) {
        base.init(equipmentScreen);
		holderType = ItemHolderType.POTION_BAG;
		col = GetComponent<BoxCollider2D>();
		hotkeyText = transform.Find("Hotkey").GetComponent<TextMesh>();
		MeshRenderer mesh = hotkeyText.GetComponent<MeshRenderer>();
		mesh.sortingLayerName = "InventoryLayer";
		mesh.sortingOrder = 5;
    }
开发者ID:aintech,项目名称:Heroes_of_Routine,代码行数:9,代码来源:PotionHolder.cs

示例13: init

	public void init (QuestBoard questBoard) {
		this.questBoard = questBoard;
		render = GetComponent<SpriteRenderer>();
		col = GetComponent<Collider2D>();
		title = transform.Find("Title").GetComponent<TextMesh>();
		rank = transform.Find("Rank").GetComponent<TextMesh>();
		title.GetComponent<MeshRenderer>().sortingOrder = render.sortingOrder + 1;
		rank.GetComponent<MeshRenderer>().sortingOrder = render.sortingOrder + 1;
	}
开发者ID:aintech,项目名称:Heroes_of_Routine,代码行数:9,代码来源:QuestScroll.cs

示例14: Start

    void Start()
    {
        foreach (Transform t in gameObject.transform){
            if(t.gameObject.name == "nameplate") {

                namePlate = t.gameObject;

            }
        }

        if ( namePlate != null ) {

            _theMesh = namePlate.GetComponent<TextMesh> ();

            _textMeshRenderer = _theMesh.GetComponent<MeshRenderer> ();

            if ( _theMesh != null )
                _theMesh.text = photonView.owner.name.ToString();

        }

        //TODO: Bugfix to allow .isMine and .owner from AWAKE!
        if (photonView.isMine)
        {
            //MINE: local player, simply enable the local scripts
            cameraScript.enabled = true;
            controllerScript.enabled = true;
            targetScript.enabled = true;
            playerScript.enabled = true;
            Camera.main.transform.parent = transform;
            Camera.main.transform.localPosition = new Vector3(0, 2, -5);
            Camera.main.transform.localEulerAngles = new Vector3(10, 0, 0);

            //_theMesh.text = PhotonNetwork.playerName;

            //if ( _textMeshRenderer != null )
                _textMeshRenderer.enabled = false;

        }
        else
        {
            cameraScript.enabled = false;
            controllerScript.enabled = true;
            targetScript.enabled = false;
            playerScript.enabled = false;

            //PhotonView _otherPlayer = GetComponent<PhotonView> ();

            //if ( _textMeshRenderer != null )
                _textMeshRenderer.enabled = true;

        }
        controllerScript.SetIsRemotePlayer(!photonView.isMine);

        gameObject.name = gameObject.name + photonView.viewID.ID;
    }
开发者ID:BGCX261,项目名称:zombie-ferox-svn-to-git,代码行数:56,代码来源:ThirdPersonNetworkVik.cs

示例15: init

	public void init () {
		addStrengthBtn = transform.Find("AddStrengthBtn").GetComponent<Button>();
		addEnduranceBtn = transform.Find("AddEnduranceBtn").GetComponent<Button>();
		addAgilityBtn = transform.Find("AddAgilityBtn").GetComponent<Button>();
		addLuckBtn = transform.Find("AddLuckBtn").GetComponent<Button>();
		attributePoints = transform.Find("AttributePoints").GetComponent<TextMesh>();
		MeshRenderer rend = attributePoints.GetComponent<MeshRenderer>();
		rend.sortingLayerName = "InventoryLayer";
		rend.sortingOrder = 1;
	}
开发者ID:aintech,项目名称:Heroes_of_Routine,代码行数:10,代码来源:AddAttributes.cs


注:本文中的UnityEngine.TextMesh.GetComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。