本文整理汇总了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);
}
示例2: Awake
// Use this for initialization
void Awake ()
{
player = GameObject.FindGameObjectWithTag("Player");
playerControl = player.GetComponent<playerControl>();
som = gameObject.GetComponent<AudioSource>();
bala = gameObject.GetComponent<MeshRenderer>();
}
示例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();
}
示例4: PlayerModel
public PlayerModel(
Rigidbody rigidBody,
MeshRenderer renderer)
{
_rigidBody = rigidBody;
_renderer = renderer;
}
示例5: Start
// Use this for initialization
void Start()
{
_meshRend = GetComponent<MeshRenderer>();
if(_meshRend != null)
_meshRend.material = GameModel.Instance.GetRandomMaterial("poster");
}
示例6: Awake
void Awake()
{
text = GetComponent<TextMesh>();
meshrenderer = GetComponent<MeshRenderer>();
meshrenderer.sortingLayerName = "ui";
meshrenderer.enabled = false;
}
示例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);
}
示例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;
}
}
示例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);
}
}
示例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);
}
示例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;
}
示例12: Start
// Use this for initialization
void Start()
{
particles = GetComponent<ParticleSystem>();
sprite = transform.Find("default").gameObject.GetComponent<MeshRenderer>();
particles.Stop();
particles.enableEmission = false;
}
示例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);
}
示例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();
}
示例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();
}
}
}