本文整理汇总了C#中UnityEngine.MeshRenderer类的典型用法代码示例。如果您正苦于以下问题:C# MeshRenderer类的具体用法?C# MeshRenderer怎么用?C# MeshRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MeshRenderer类属于UnityEngine命名空间,在下文中一共展示了MeshRenderer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: enableObject
public void enableObject(int index)
{
gameObject.SetActive(true);
mr = GetComponent<MeshRenderer>();
mr.material = mats[index];
enabledcard = true;
}
开发者ID:niguerrac,项目名称:UnityUI,代码行数:7,代码来源:rippleSharp.cs
示例17: Update
// Update is called once per frame
void Update()
{
if(player == null)
player = GameObject.FindGameObjectWithTag("Player");
Vector3 dest = player.transform.position;
dest.z += 20;
Ray ray = new Ray(gameObject.transform.position, (player.gameObject.transform.position - gameObject.transform.position).normalized);
RaycastHit hit;
//Reset old materials. This will be overriden if the renderer is still being hit.
if(oldRenderer != null)
oldRenderer.material = originalMaterial;
int layermask = 1 << 10;
if(Physics.Raycast(ray, out hit, 10000, layermask)){
MeshCollider collider = (MeshCollider) hit.collider;
if(collider != null){
MeshRenderer renderer = collider.gameObject.GetComponent(typeof(MeshRenderer)) as MeshRenderer;
renderer.material = transparentMaterial;
oldRenderer = renderer;
}
}
}
开发者ID:DanOpdyke,项目名称:SpitfinityDan-v2,代码行数:26,代码来源:BuildingOpacityScript.cs
示例18: Start
protected override void Start()
{
base.Start();
laserMesh = transform.FindChild("Laser").gameObject.GetComponent<MeshRenderer>();
laserCollider = transform.FindChild("Laser").gameObject.GetComponent<BoxCollider>();
mirrorSync = GetComponent<spt_mirrorSync>();
}
开发者ID:misterplatt,项目名称:Shackle-170,代码行数:7,代码来源:spt_mirror.cs
示例19: CreateInstance
public override Image CreateInstance()
{
var trackerObj = new GameObject(string.Format("{0}_Tracker", transform.name));
var trackerImg = trackerObj.AddComponent<Image>();
trackerImg.rectTransform.pivot = new Vector2(0.5f, 0.5f);
trackerImg.color = new Color(1f, 1f, 1f, 1f);
_arrowSprite = ArrowSprite;
trackerImg.SetNativeSize();
_imageInstance = trackerImg;
_imageInstance.color = TrackerColor;
_width = _imageInstance.rectTransform.rect.width;
_trackerPlaneInstance = Instantiate(TrackerPlanePrefab);
_trackerPlaneRenderer = _trackerPlaneInstance.GetComponent<MeshRenderer>();
_isVisible = false;
SetAlpha(0f);
_lastDistanceSquared = Mathf.Infinity;
return trackerImg;
}
开发者ID:talford2,项目名称:SpaceX,代码行数:25,代码来源:CollectibleTracker.cs
示例20: ManualUpdate
public void ManualUpdate()
{
if (Group != 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 != Group.Material)
{
SgtHelper.BeginStealthSet(MeshRenderer);
{
MeshRenderer.sharedMaterial = Group.Material;
}
SgtHelper.EndStealthSet();
}
}
}
开发者ID:Battlespud,项目名称:ducking-octo-shame,代码行数:27,代码来源:SgtBeltModel.cs
注:本文中的UnityEngine.MeshRenderer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论