當前位置: 首頁>>代碼示例>>C#>>正文


C# UnityEngine.MeshRenderer類代碼示例

本文整理匯總了C#中UnityEngine.MeshRenderer的典型用法代碼示例。如果您正苦於以下問題:C# MeshRenderer類的具體用法?C# MeshRenderer怎麽用?C# MeshRenderer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MeshRenderer類屬於UnityEngine命名空間,在下文中一共展示了MeshRenderer類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: init

 internal void init()
 {
     shipHull = GameObject.Find ("Hull").GetComponent<MeshRenderer>();
     shipFin = GameObject.Find ("Fin").GetComponent<MeshRenderer>();
     //			latestGO = Instantiate(Resources.Load("Textfield")) as GameObject;
     //			GameObject go = latestGO;
     //			go.name = "first";
     //
     //			TextMesh textMesh = go.GetComponent<TextMesh>();
     //			textMesh.text = "http://www.thirdmotion.com";
     //			textMesh.font.material.color = Color.red;
     //
     //			Vector3 localPosition = go.transform.localPosition;
     //			localPosition.x -= go.renderer.bounds.extents.x;
     //			localPosition.y += go.renderer.bounds.extents.y;
     //			go.transform.localPosition = localPosition;
     //
     //			Vector3 extents = Vector3.zero;
     //			extents.x = go.renderer.bounds.size.x;
     //			extents.y = go.renderer.bounds.size.y;
     //			extents.z = go.renderer.bounds.size.z;
     //			(go.collider as BoxCollider).size = extents;
     //			(go.collider as BoxCollider).center = -localPosition;
     //
     //			go.transform.parent = gameObject.transform;
     //
     //			go.AddComponent<ClickDetector>();
     //			ClickDetector clicker = go.GetComponent<ClickDetector>() as ClickDetector;
     //			clicker.clickSignal.AddListener(onClick);
     UpdateColor (Color.cyan);
 }
開發者ID:Danubian,項目名稱:AwesomeWeekendHack,代碼行數:31,代碼來源:AwesomeSpaceShipView.cs

示例2: Awake

	// Use this for initialization
	void Awake () 
    {
        player = GameObject.FindGameObjectWithTag("Player");
        playerControl = player.GetComponent<playerControl>();
        som = gameObject.GetComponent<AudioSource>();
        bala = gameObject.GetComponent<MeshRenderer>();
	}
開發者ID:paulodgn,項目名稱:humanity_Ambientes,代碼行數:8,代碼來源:playerGetBullets.cs

示例3: Init

 void Init(bool ForceNewMat = false)
 {
     if (spriteRenderer == null)
     {
         spriteRenderer = GetComponent<MeshRenderer>();
     }
     if (MaterialRef == null)
     {
         MaterialRef = (Material)Resources.Load("Materials/SpriteRepeat", typeof(Material));
     }
     if (materialInstance == null || ForceNewMat)
     {
         if (!Application.isPlaying)
         {
             materialInstance = new Material(MaterialRef);
             spriteRenderer.sharedMaterial = materialInstance;
         }
         else
             materialInstance = spriteRenderer.sharedMaterial;
     }
     if (materialInstance.mainTexture != TextureToRepeat)
     {
         materialInstance.mainTexture = TextureToRepeat;
     }
     FitScale();
 }
開發者ID:vizigr0u,項目名稱:ggj2016,代碼行數:26,代碼來源:RepeatSprite.cs

示例4: PlayerModel

 public PlayerModel(
     Rigidbody rigidBody,
     MeshRenderer renderer)
 {
     _rigidBody = rigidBody;
     _renderer = renderer;
 }
開發者ID:Soren025,項目名稱:Zenject,代碼行數:7,代碼來源:PlayerModel.cs

示例5: Start

    // Use this for initialization
    void Start()
    {
        _meshRend = GetComponent<MeshRenderer>();

        if(_meshRend != null)
            _meshRend.material = GameModel.Instance.GetRandomMaterial("poster");
    }
開發者ID:aimozs,項目名稱:Scripts,代碼行數:8,代碼來源:Poster.cs

示例6: Awake

 void Awake()
 {
     text = GetComponent<TextMesh>();
     meshrenderer = GetComponent<MeshRenderer>();
     meshrenderer.sortingLayerName = "ui";
     meshrenderer.enabled = false;
 }
開發者ID:krylorz,項目名稱:New-Space-Scavs-Repo,代碼行數:7,代碼來源:CarryableText.cs

示例7: DebugArrow

        public DebugArrow(Color color, bool seeThrough = false)
        {
            gameObject = new GameObject("DebugArrow");
            gameObject.layer = 15; // Change layer. Not reentry effect that way (TODO :  try 22)

            haft = CreateCone(1f, 0.05f, 0.05f, 0f, 20);
            haft.transform.parent = gameObject.transform;
            haft.transform.localRotation = Quaternion.Euler(90, 0, 0);
            haft.layer = 15;

            cone = CreateCone(coneLength, 0.15f, 0f, 0f, 20);
            cone.transform.parent = gameObject.transform;
            cone.transform.localRotation = Quaternion.Euler(90, 0, 0);
            cone.layer = 15;

            SetLength(4);

            _haftMeshRenderer = haft.AddComponent<MeshRenderer>();
            _coneMeshRenderer = cone.AddComponent<MeshRenderer>();

            _haftMeshRenderer.material.color = color;
            _haftMeshRenderer.castShadows = false;
            _haftMeshRenderer.receiveShadows = false;

            _coneMeshRenderer.material.color =  color;
            _coneMeshRenderer.castShadows = false;
            _coneMeshRenderer.receiveShadows = false;

            SeeThrough(seeThrough);
        }
開發者ID:bruchpilotxxl,項目名稱:MechJeb2,代碼行數:30,代碼來源:MechJebModuleDebugArrows.cs

示例8: Start

	void Start() 
	{
        moveComponent = gameObject.GetComponent<PSMoveController>();
        rendererComponent = gameObject.GetComponent<MeshRenderer>();

        // Button Pressed callbacks
        moveComponent.OnButtonTrianglePressed += move_OnButtonTrianglePressed;
        moveComponent.OnButtonCirclePressed += move_OnButtonCirclePressed;
        moveComponent.OnButtonCrossPressed += move_OnButtonCrossPressed;
        moveComponent.OnButtonSquarePressed += move_OnButtonSquarePressed;
        moveComponent.OnButtonSelectPressed += move_OnButtonSelectPressed;
        moveComponent.OnButtonStartPressed += move_OnButtonStartPressed;
        moveComponent.OnButtonPSPressed += move_OnButtonPSPressed;
        moveComponent.OnButtonMovePressed += move_OnButtonMovePressed;

        // Button Release callbacks
        moveComponent.OnButtonTriangleReleased += move_OnButtonTriangleReleased;
        moveComponent.OnButtonCircleReleased += move_OnButtonCircleReleased;
        moveComponent.OnButtonCrossReleased += move_OnButtonCrossReleased;
        moveComponent.OnButtonSquareReleased += move_OnButtonSquareReleased;
        moveComponent.OnButtonSelectReleased += move_OnButtonSelectReleased;
        moveComponent.OnButtonStartReleased += move_OnButtonStartReleased;
        moveComponent.OnButtonPSReleased += move_OnButtonPSReleased;
        moveComponent.OnButtonMoveReleased += move_OnButtonMoveReleased;

        // Don't show the controller model until we get tracking
        if (HideWhenUntracked && rendererComponent != null)
        {
            rendererComponent.enabled = false;
        }
    }
開發者ID:provencher,項目名稱:psmove-unity5,代碼行數:31,代碼來源:PSMoveTest.cs

示例9: ManualUpdate

    public void ManualUpdate(Mesh mesh, Material material, Quaternion rotation)
    {
        if (Ring != null)
        {
            if (MeshFilter == null) MeshFilter = gameObject.AddComponent<MeshFilter>();

            if (MeshRenderer == null) MeshRenderer = gameObject.AddComponent<MeshRenderer>();

            if (MeshFilter.sharedMesh != mesh)
            {
                SgtHelper.BeginStealthSet(MeshFilter);
                {
                    MeshFilter.sharedMesh = mesh;
                }
                SgtHelper.EndStealthSet();
            }

            if (MeshRenderer.sharedMaterial != material)
            {
                SgtHelper.BeginStealthSet(MeshRenderer);
                {
                    MeshRenderer.sharedMaterial = material;
                }
                SgtHelper.EndStealthSet();
            }

            SgtHelper.SetLocalRotation(transform, rotation);
        }
    }
開發者ID:JasonSlingsCode,項目名稱:Mindjammer,代碼行數:29,代碼來源:SgtRingSegment.cs

示例10: Awake

    void Awake()
    {
        Cursor = transform.Find("Cursor").gameObject;

        CursorMeshRenderer = Cursor.transform.GetComponentInChildren<MeshRenderer>();
        CursorMeshRenderer.renderer.material.color = new Color(0.0f, 0.8f, 1.0f);
    }
開發者ID:conlan,項目名稱:altspacevr-project-unity-cursor,代碼行數:7,代碼來源:SphericalCursorModule.cs

示例11: OnEnable

        void OnEnable()
        {
            foreach(Transform child in transform)
            {
                //Search for child Loading Background to get the mesh renderer for the background texture
                if(child.name == "Loading Background")
                {
                    m_MeshRenderer = child.GetComponent<MeshRenderer>();
                }
                if(child.name == "Loading Percent")
                {
                    m_LoadingText = child.GetComponent<TextMesh>();
                }
            }

            if(m_MeshRenderer == null)
            {
                Debug.LogError("Missing a gameobject with the name \'Loading Background\' and a \'MeshRenderer\' component.");
                gameObject.SetActive(false);
                return;
            }
            if(m_LoadingText == null)
            {
                Debug.LogError("Missing a gameobject with the name \'Loading Text\' and a \'TextMesh\' component.");
                gameObject.SetActive(false);
                return;
            }
            Material material = new Material(m_MeshRenderer.sharedMaterial);
            material.SetTexture("_MainTex", m_TextureToDisplay);
            m_MeshRenderer.material = material;
        }
開發者ID:NathanSaidas,項目名稱:OnLooker_Unity,代碼行數:31,代碼來源:LoadScreen.cs

示例12: Start

 // Use this for initialization
 void Start()
 {
     particles = GetComponent<ParticleSystem>();
     sprite = transform.Find("default").gameObject.GetComponent<MeshRenderer>();
     particles.Stop();
     particles.enableEmission = false;
 }
開發者ID:ragingRobot,項目名稱:LD30,代碼行數:8,代碼來源:Capsule.cs

示例13: Start

	// Use this for initialization
	void Start () 
	{
		rend = GetComponent<MeshRenderer> ();
		oldColor = rend.sharedMaterial.color;
		transparentColor = new Color (oldColor.r, oldColor.g, oldColor.b, opacityLevel);

	}
開發者ID:pencilking2002,項目名稱:TOF_Movement_Protype,代碼行數:8,代碼來源:TransparentLogic.cs

示例14: FRenderLayer

    public FRenderLayer(FStage stage, FAtlas atlas, FShader shader)
    {
        _stage = stage;

        _atlas = atlas;
        _shader = shader;

        _expansionAmount = Futile.quadsPerLayerExpansion;
        _maxEmptyQuads = Futile.maxEmptyQuadsPerLayer;

        batchIndex = atlas.index*10000 + shader.index;

        _gameObject = new GameObject("FRenderLayer ("+_stage.name+")");
        _transform = _gameObject.transform;

        _transform.parent = Futile.instance.gameObject.transform;

        _meshFilter = _gameObject.AddComponent<MeshFilter>();
        _meshRenderer = _gameObject.AddComponent<MeshRenderer>();
        _meshRenderer.castShadows = false;
        _meshRenderer.receiveShadows = false;

        _mesh = _meshFilter.mesh;

        _material = new Material(_shader.shader);
        _material.mainTexture = _atlas.texture;

        _meshRenderer.renderer.material = _material;

        _gameObject.active = false;

        ExpandMaxQuadLimit(Futile.startingQuadsPerLayer);

        UpdateTransform();
    }
開發者ID:HaKDMoDz,項目名稱:awayteam,代碼行數:35,代碼來源:FRenderLayer.cs

示例15: ManualUpdate

    public void ManualUpdate(Mesh mesh, Material material)
    {
        if (Jovian != null)
        {
            if (MeshFilter == null) MeshFilter = gameObject.AddComponent<MeshFilter>();

            if (MeshRenderer == null) MeshRenderer = gameObject.AddComponent<MeshRenderer>();

            if (MeshFilter.sharedMesh != mesh)
            {
                SgtHelper.BeginStealthSet(MeshFilter);
                {
                    MeshFilter.sharedMesh = mesh;
                }
                SgtHelper.EndStealthSet();
            }

            if (MeshRenderer.sharedMaterial != material)
            {
                SgtHelper.BeginStealthSet(MeshRenderer);
                {
                    MeshRenderer.sharedMaterial = material;
                }
                SgtHelper.EndStealthSet();
            }
        }
    }
開發者ID:Battlespud,項目名稱:ducking-octo-shame,代碼行數:27,代碼來源:SgtJovianModel.cs


注:本文中的UnityEngine.MeshRenderer類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。