// Use this for initialization
	void Awake () 
    {
        player = GameObject.FindGameObjectWithTag("Player");
        playerControl = player.GetComponent<playerControl>();
        som = gameObject.GetComponent<AudioSource>();
        bala = gameObject.GetComponent<MeshRenderer>();
	}
 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);
 }
示例#3
1
 public PlayerModel(
     Rigidbody rigidBody,
     MeshRenderer renderer)
 {
     _rigidBody = rigidBody;
     _renderer = renderer;
 }
示例#4
1
 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();
 }
示例#5
0
    public void NewTarget(GameObject targ)
    {
        if ( target != targ )
        {
            target = targ;
            t = 0.0f;

            if ( target )
            {
                filter = (MeshFilter)target.GetComponent(typeof(MeshFilter));

                if ( filter != null )
                    center = filter.mesh.bounds.center;
                else
                {
                    render = (MeshRenderer)target.GetComponent(typeof(MeshRenderer));

                    if ( render != null )
                        center = render.bounds.center;
                    else
                    {
                        srender = (SkinnedMeshRenderer)target.GetComponent(typeof(SkinnedMeshRenderer));

                        if ( srender != null )
                            center = srender.bounds.center;
                    }
                }
            }
        }
    }
 /// <summary>
 /// Write the specified value using the writer.
 /// </summary>
 /// <param name="value">Value.</param>
 /// <param name="writer">Writer.</param>
 public override void Write(object value, ISaveGameWriter writer)
 {
     UnityEngine.MeshRenderer meshRenderer = (UnityEngine.MeshRenderer)value;
     writer.WriteProperty("additionalVertexStreams", meshRenderer.additionalVertexStreams);
     writer.WriteProperty("enabled", meshRenderer.enabled);
     writer.WriteProperty("shadowCastingMode", meshRenderer.shadowCastingMode);
     writer.WriteProperty("receiveShadows", meshRenderer.receiveShadows);
     writer.WriteProperty("material", meshRenderer.material);
     writer.WriteProperty("sharedMaterial", meshRenderer.sharedMaterial);
     writer.WriteProperty("materials", meshRenderer.materials);
     writer.WriteProperty("sharedMaterials", meshRenderer.sharedMaterials);
     writer.WriteProperty("lightmapIndex", meshRenderer.lightmapIndex);
     writer.WriteProperty("realtimeLightmapIndex", meshRenderer.realtimeLightmapIndex);
     writer.WriteProperty("lightmapScaleOffset", meshRenderer.lightmapScaleOffset);
     writer.WriteProperty("motionVectorGenerationMode", meshRenderer.motionVectorGenerationMode);
     writer.WriteProperty("realtimeLightmapScaleOffset", meshRenderer.realtimeLightmapScaleOffset);
     writer.WriteProperty("lightProbeUsage", meshRenderer.lightProbeUsage);
     writer.WriteProperty("lightProbeProxyVolumeOverride", meshRenderer.lightProbeProxyVolumeOverride);
     writer.WriteProperty("probeAnchor", meshRenderer.probeAnchor);
     writer.WriteProperty("reflectionProbeUsage", meshRenderer.reflectionProbeUsage);
     writer.WriteProperty("sortingLayerName", meshRenderer.sortingLayerName);
     writer.WriteProperty("sortingLayerID", meshRenderer.sortingLayerID);
     writer.WriteProperty("sortingOrder", meshRenderer.sortingOrder);
     writer.WriteProperty("tag", meshRenderer.tag);
     writer.WriteProperty("name", meshRenderer.name);
     writer.WriteProperty("hideFlags", meshRenderer.hideFlags);
 }
示例#7
0
        public Node(GameObject source)
        {
            id       = IdManager.Instance.CreateNodeId();
            name     = source.name;
            enabled  = source.activeInHierarchy;
            position = source.transform.localPosition;
            rotation = source.transform.localRotation;
            scale    = source.transform.localScale;

            components = new List <Component>();
            UnityEngine.Light light = source.GetComponent <UnityEngine.Light>();
            if (light)
            {
                components.Add(new Light(light));
            }

            UnityEngine.Camera camera = source.GetComponent <UnityEngine.Camera>();
            if (camera)
            {
                components.Add(new Camera(camera));
            }

            UnityEngine.MeshRenderer meshRenderer = source.GetComponent <UnityEngine.MeshRenderer>();
            UnityEngine.MeshFilter   meshFilter   = source.GetComponent <UnityEngine.MeshFilter>();
            if (meshRenderer && meshFilter)
            {
                components.Add(new StaticModel(meshRenderer, meshFilter));
            }

            nodes = new List <Node>();
            foreach (UnityEngine.Transform child in source.transform)
            {
                nodes.Add(new Node(child.gameObject));
            }
        }
示例#8
0
 static public int set_receiveGI(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.MeshRenderer self = (UnityEngine.MeshRenderer)checkSelf(l);
         UnityEngine.ReceiveGI    v;
         v = (UnityEngine.ReceiveGI)LuaDLL.luaL_checkinteger(l, 2);
         self.receiveGI = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
    public void ManualUpdate(Mesh mesh, Material outerMaterial, float outerScale)
    {
        if (Corona != 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 != outerMaterial)
            {
                SgtHelper.BeginStealthSet(MeshRenderer);
                {
                    MeshRenderer.sharedMaterial = outerMaterial;
                }
                SgtHelper.EndStealthSet();
            }

            SgtHelper.SetLocalScale(transform, outerScale);
        }
    }
示例#10
0
        public static Entity ConvertSubmesh(GameObjectConversionSystem gsys, UnityEngine.MeshRenderer uMeshRenderer,
                                            UnityEngine.Mesh uMesh, Entity meshEntity, int subMeshIndex, Entity materialEntity)
        {
            Entity primaryMeshRenderer = gsys.GetPrimaryEntity(uMeshRenderer);
            Entity meshRendererEntity  = primaryMeshRenderer;

            if (subMeshIndex > 0)
            {
                meshRendererEntity = gsys.CreateAdditionalEntity(uMeshRenderer);
                AddTransformComponent(gsys, primaryMeshRenderer, meshRendererEntity);
            }

            gsys.DstEntityManager.AddComponentData(meshRendererEntity, new Unity.Tiny.Rendering.MeshRenderer()
            {
                mesh       = meshEntity,
                material   = materialEntity,
                startIndex = Convert.ToInt32(uMesh.GetIndexStart(subMeshIndex)),
                indexCount = Convert.ToInt32(uMesh.GetIndexCount(subMeshIndex))
            });

            gsys.DstEntityManager.AddComponentData(meshRendererEntity, new Unity.Tiny.Rendering.CameraMask()
            {
                mask = (ulong)(1 << uMeshRenderer.gameObject.layer)
            });

            gsys.DstEntityManager.AddComponentData(meshRendererEntity, new WorldBounds());

            return(meshRendererEntity);
        }
示例#11
0
    static int _CreateUnityEngine_MeshRenderer(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.MeshRenderer.ctor");
#endif
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                UnityEngine.MeshRenderer obj = new UnityEngine.MeshRenderer();
                ToLua.Push(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.MeshRenderer.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
 static public int set_additionalVertexStreams(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.MeshRenderer self = (UnityEngine.MeshRenderer)checkSelf(l);
         UnityEngine.Mesh         v;
         checkType(l, 2, out v);
         self.additionalVertexStreams = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
示例#13
0
	// Use this for initialization
	void Start () {
        mesh = screen.GetComponent<MeshRenderer>();
        if (mesh != null)
        {
            mat = mesh.material;
        }
	}
    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);
        }
    }
    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();
            }
        }
    }
示例#16
0
    void Start()
    {

        child = GetComponentInChildren<MeshRenderer>();

        Vector3 parentScale = transform.parent.localScale;

        //make render texture that fits the object
        if(parentScale.x <= parentScale.y)
            tex = new RenderTexture(Mathf.CeilToInt(parentScale.x) * scaleFactor, Mathf.CeilToInt(parentScale.y) * scaleFactor, 0);
        else
            tex = new RenderTexture(Mathf.CeilToInt(parentScale.x) * scaleFactor, Mathf.CeilToInt(parentScale.y) * scaleFactor/2, 0);

        //tex.Create();

        tex.filterMode = FilterMode.Point;
        tex.anisoLevel = 0;

        tex.depth = (int)Depth;

        tex.filterMode = textureFilterMode;

        //tex.Create();

        //get camera
        cam = GetComponent<Camera>();
        cam.orthographicSize = parentScale.y/2;

        cam.targetTexture = tex;

        //cam.clearFlags = CameraClearFlags.Depth;

        child.material.mainTexture = tex;
    }
    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();
            }
        }
    }
    // 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;
            }
        }
    }
示例#19
0
	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;
        }
    }
示例#20
0
    // Use this for initialization
    void Start()
    {
        objectMesh = GetComponent<MeshRenderer>();

        // Disable the mesh renderer component
        objectMesh.enabled = false;

        // Get all the cube pickups in the level
        getPickUps();

        // Reference the playerSphere
        getPlayer();

        // Reference the hudManager
        mainHUD = FindObjectOfType<hudManager>();
    
        // Get the audio source component
        getClockAudioSource();

        // Set clock audio clip
        setClockAudioClip();

        clockSoundManager = FindObjectOfType<ClockSoundManager>();

        playerScore = 0;

        targetScore = setTargetScore;

        defaultClockLength = clockLength;

        print(targetScore);

    }
示例#21
0
    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;
    }
示例#22
0
    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();
    }
示例#23
0
	// Use this for initialization
	void Start () 
	{
		doorFrameRenderer = doorFrame.GetComponent<MeshRenderer> ();
		doorRenderer = door.GetComponent<MeshRenderer> ();
		originalFrameShader = doorFrameRenderer.material.shader;
		originalDoorShader = doorRenderer.material.shader;
	}
示例#24
0
文件: Poster.cs 项目: aimozs/Scripts
    // Use this for initialization
    void Start()
    {
        _meshRend = GetComponent<MeshRenderer>();

        if(_meshRend != null)
            _meshRend.material = GameModel.Instance.GetRandomMaterial("poster");
    }
 static public int get_subMeshStartIndex(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.MeshRenderer self = (UnityEngine.MeshRenderer)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.subMeshStartIndex);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
示例#26
0
 static public int constructor(IntPtr l)
 {
     UnityEngine.MeshRenderer o;
     o = new UnityEngine.MeshRenderer();
     pushObject(l, o);
     return(1);
 }
示例#27
0
 // Use this for initialization
 void Start()
 {
     // create new material instance
     myRenderer = GetComponent<MeshRenderer>();
     material = new Material(myRenderer.material);
     myRenderer.material = material;
 }
示例#28
0
            public void Init(Factory factory)
            {
                renderers = new List <IMeshRenderer>();

                mesh      = new Mesh();
                mesh.name = "LWF/" + factory.data.name;
                mesh.MarkDynamic();

                meshFilter            = gameObject.AddComponent <MeshFilter>();
                meshFilter.sharedMesh = mesh;

                meshRenderer = gameObject.AddComponent <UnityEngine.MeshRenderer>();
#if UNITY_4_6
                meshRenderer.castShadows = false;
#else
                meshRenderer.shadowCastingMode =
                    UnityEngine.Rendering.ShadowCastingMode.Off;
#endif
                meshRenderer.receiveShadows = false;
                UpdateSortingLayerAndOrder(factory);
                UpdateLayer(factory);

                if (factory.useAdditionalColor)
                {
                    additionalColor   = UnityEngine.Color.clear;
                    property          = new MaterialPropertyBlock();
                    additionalColorId = Shader.PropertyToID("_AdditionalColor");
                }

                buffer = new CombinedMeshBuffer();
            }
        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);
        }
	// Use this for initialization
	void Start () 
	{
		rend = GetComponent<MeshRenderer> ();
		oldColor = rend.sharedMaterial.color;
		transparentColor = new Color (oldColor.r, oldColor.g, oldColor.b, opacityLevel);

	}
示例#31
0
    void Start()
    {
        renderer.enabled = false;
        meshRenderer = GetComponent<MeshRenderer>();
        if(!meshRenderer) meshRenderer = gameObject.AddComponent<MeshRenderer>();
        meshRenderer.material = new Material("Shader \"Lines/Background\" { Properties { _Color (\"Main Color\", Color) = (1,1,1,1) } SubShader { Pass {" + (ZWrite ? " ZWrite on " : " ZWrite off ") + (blend ? " Blend SrcAlpha OneMinusSrcAlpha" : " ") + (AWrite ? " Colormask RGBA " : " ") + "Lighting Off Offset 1, 1 Color[_Color] }}}");

        // New Syntax with Bind :
        lineMaterial = new Material("Shader \"Lines/Colored Blended\" { SubShader { Pass { Blend SrcAlpha OneMinusSrcAlpha BindChannels { Bind \"Color\",color } ZWrite On Cull Front Fog { Mode Off } } } }");

        lineMaterial.hideFlags = HideFlags.HideAndDontSave;
        lineMaterial.shader.hideFlags = HideFlags.HideAndDontSave;

        List<Vector3> linesArray = new List<Vector3>();
        MeshFilter filter = GetComponent<MeshFilter>();
        var mesh = filter.sharedMesh;
        var vertices = mesh.vertices;
        var triangles = mesh.triangles;

        for (int i = 0; i < triangles.Length / 3; i++)
        {
            linesArray.Add(vertices[triangles[i * 3]]);
            linesArray.Add(vertices[triangles[i * 3 + 1]]);
            linesArray.Add(vertices[triangles[i * 3 + 2]]);
        }

        lines = linesArray.Select(item => (Vector3)item).ToArray();
    }
示例#32
0
 // Use this for initialization
 void Start()
 {
     particles = GetComponent<ParticleSystem>();
     sprite = transform.Find("default").gameObject.GetComponent<MeshRenderer>();
     particles.Stop();
     particles.enableEmission = false;
 }
 void Start()
 {
     mf_ = GetComponent<MeshFilter>();
     mr_ = GetComponent<MeshRenderer>();
     mf_.sharedMesh = Explosion.Instance.getMesh();
     mr_.sharedMaterial = Explosion.Instance.getMaterial();
 }
示例#34
0
        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;
        }
    private void Start () 
    {
        myMeshRenderer = GetComponent<MeshRenderer>();
        myMeshRenderer.material.EnableKeyword("_EMISSION");

        startTime = Time.time;
	}
    void Awake()
    {
        Cursor = transform.Find("Cursor").gameObject;

        CursorMeshRenderer = Cursor.transform.GetComponentInChildren<MeshRenderer>();
        CursorMeshRenderer.renderer.material.color = new Color(0.0f, 0.8f, 1.0f);
    }
示例#37
0
 public void enableObject(int index)
 {
     gameObject.SetActive(true);
     mr = GetComponent<MeshRenderer>();
     mr.material = mats[index];
     enabledcard = true;
 }
 void Awake()
 {
     text = GetComponent<TextMesh>();
     meshrenderer = GetComponent<MeshRenderer>();
     meshrenderer.sortingLayerName = "ui";
     meshrenderer.enabled = false;
 }
示例#39
0
    static int ClearTexture(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                BaseResLoader       obj  = (BaseResLoader)ToLua.CheckObject <BaseResLoader>(L, 1);
                UnityEngine.Texture arg0 = (UnityEngine.Texture)ToLua.CheckObject <UnityEngine.Texture>(L, 2);
                obj.ClearTexture(ref arg0);
                ToLua.Push(L, arg0);
                return(1);
            }
            else if (count == 3)
            {
                BaseResLoader            obj  = (BaseResLoader)ToLua.CheckObject <BaseResLoader>(L, 1);
                UnityEngine.MeshRenderer arg0 = (UnityEngine.MeshRenderer)ToLua.CheckObject(L, 2, typeof(UnityEngine.MeshRenderer));
                string arg1 = ToLua.CheckString(L, 3);
                obj.ClearTexture(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: BaseResLoader.ClearTexture"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
示例#40
0
 protected override void Start()
 {
     base.Start();
     laserMesh = transform.FindChild("Laser").gameObject.GetComponent<MeshRenderer>();
     laserCollider = transform.FindChild("Laser").gameObject.GetComponent<BoxCollider>();
     mirrorSync = GetComponent<spt_mirrorSync>();
 }
 public static int  obj_hash(long L)
 {
     UnityEngine.MeshRenderer obj = FCGetObj.GetObj <UnityEngine.MeshRenderer>(L);
     if (obj != null)
     {
         return(obj.GetHashCode());
     }
     return(0);
 }
 static public void FastSetter(this UnityEngine.MeshRenderer o, string propertyName, UnityEngine.Mesh value)
 {
     switch (propertyName)
     {
     case "additionalVertexStreams":
         o.additionalVertexStreams = value; return;
     }
     LBoot.LogUtil.Error("UnityEngine.MeshRenderer no Setter Found : " + propertyName);
 }
示例#43
0
 public override bool ResourceEquals(object otherSource, object otherInstanceData)
 {
     if (source != otherSource)
     {
         return(false);
     }
     UnityEngine.MeshRenderer m1 = (UnityEngine.MeshRenderer)instanceData;
     UnityEngine.MeshRenderer m2 = (UnityEngine.MeshRenderer)otherInstanceData;
     return(m1.lightmapIndex < 0 && m2.lightmapIndex < 0);
 }
示例#44
0
 static public int get_additionalVertexStreams(IntPtr l)
 {
     try {
         UnityEngine.MeshRenderer self = (UnityEngine.MeshRenderer)checkSelf(l);
         pushValue(l, self.additionalVertexStreams);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#45
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.MeshRenderer o;
         o = new UnityEngine.MeshRenderer();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#46
0
 static public int get_subMeshStartIndex(IntPtr l)
 {
     try {
         UnityEngine.MeshRenderer self = (UnityEngine.MeshRenderer)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.subMeshStartIndex);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#47
0
 static public int constructor(IntPtr l)
 {
     try {
         UnityEngine.MeshRenderer o;
         o = new UnityEngine.MeshRenderer();
         pushValue(l, o);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
示例#48
0
 static public int set_additionalVertexStreams(IntPtr l)
 {
     try {
         UnityEngine.MeshRenderer self = (UnityEngine.MeshRenderer)checkSelf(l);
         UnityEngine.Mesh         v;
         checkType(l, 2, out v);
         self.additionalVertexStreams = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#49
0
 static public int constructor(IntPtr l)
 {
     LuaDLL.lua_remove(l, 1);
     UnityEngine.MeshRenderer o;
     if (matchType(l, 1))
     {
         o = new UnityEngine.MeshRenderer();
         pushObject(l, o);
         return(1);
     }
     LuaDLL.luaL_error(l, "New object failed.");
     return(0);
 }
 public static bool  obj_equal(long L, long R)
 {
     UnityEngine.MeshRenderer left  = FCGetObj.GetObj <UnityEngine.MeshRenderer>(L);
     UnityEngine.MeshRenderer right = FCGetObj.GetObj <UnityEngine.MeshRenderer>(R);
     if (left != null)
     {
         return(left.Equals(right));
     }
     if (right != null)
     {
         return(right.Equals(left));
     }
     return(true);
 }
 public static int set_additionalVertexStreams_wrap(long L)
 {
     try
     {
         long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L);
         UnityEngine.MeshRenderer ret  = get_obj(nThisPtr);
         UnityEngine.Mesh         arg0 = FCGetObj.GetObj <UnityEngine.Mesh>(FCLibHelper.fc_get_wrap_objptr(L, 0));
         ret.additionalVertexStreams = arg0;
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
示例#52
0
// fields

// properties
    static void MeshRenderer_additionalVertexStreams(JSVCall vc)
    {
        if (vc.bGet)
        {
            UnityEngine.MeshRenderer _this = (UnityEngine.MeshRenderer)vc.csObj;
            var result = _this.additionalVertexStreams;
            JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
        }
        else
        {
            UnityEngine.Mesh         arg0  = (UnityEngine.Mesh)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            UnityEngine.MeshRenderer _this = (UnityEngine.MeshRenderer)vc.csObj;
            _this.additionalVertexStreams = arg0;
        }
    }
 private void LazyIntialize()
 {
     if (this.buffers == null)
     {
         this.buffers = new MeshRendererBuffers();
         this.buffers.Initialize();
         if (this.meshGenerator == null)
         {
             this.meshGenerator = new Spine.Unity.MeshGenerator();
             this.meshFilter    = base.GetComponent <UnityEngine.MeshFilter>();
             this.meshRenderer  = base.GetComponent <UnityEngine.MeshRenderer>();
             this.currentInstructions.Clear();
         }
     }
 }
示例#54
0
 public StaticModel(UnityEngine.MeshRenderer renderer, UnityEngine.MeshFilter filter) :
     base(renderer)
 {
     material    = ResourceCache.Instance.GetMaterial(renderer.sharedMaterial, renderer);
     model       = ResourceCache.Instance.GetModel(filter.sharedMesh, renderer);
     castShadows = renderer.shadowCastingMode != UnityEngine.Rendering.ShadowCastingMode.Off;
     if (renderer.lightmapIndex >= 0)
     {
         lightMask = (int)LightmapBakeType.Realtime;
     }
     else
     {
         lightMask = (int)LightmapBakeType.Realtime | (int)LightmapBakeType.Mixed;
     }
 }
示例#55
0
 static int ClearMainTexture(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         BaseResLoader            obj  = (BaseResLoader)ToLua.CheckObject <BaseResLoader>(L, 1);
         UnityEngine.MeshRenderer arg0 = (UnityEngine.MeshRenderer)ToLua.CheckObject(L, 2, typeof(UnityEngine.MeshRenderer));
         obj.ClearMainTexture(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
 public static int get_additionalVertexStreams_wrap(long L)
 {
     try
     {
         long nThisPtr = FCLibHelper.fc_get_inport_obj_ptr(L);
         UnityEngine.MeshRenderer ret = get_obj(nThisPtr);
         long ret_ptr = FCLibHelper.fc_get_return_ptr(L);
         long v       = FCGetObj.PushObj(ret.additionalVertexStreams);
         FCLibHelper.fc_set_value_wrap_objptr(ret_ptr, v);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     return(0);
 }
示例#57
0
    static int set_additionalVertexStreams(IntPtr L)
    {
        UnityEngine.MeshRenderer obj  = (UnityEngine.MeshRenderer)ToLua.ToObject(L, 1);
        UnityEngine.Mesh         arg0 = (UnityEngine.Mesh)ToLua.CheckUnityObject(L, 2, typeof(UnityEngine.Mesh));

        try
        {
            obj.additionalVertexStreams = arg0;
        }
        catch (Exception e)
        {
            return(LuaDLL.luaL_error(L, obj == null ? "attempt to index additionalVertexStreams on a nil value" : e.Message));
        }

        return(0);
    }
示例#58
0
        void Awake()
        {
            m_MeshFilter = GetComponent <MeshFilter>();
            if (!m_MeshFilter)
            {
                m_MeshFilter = gameObject.AddComponent <MeshFilter>();
            }
            m_MeshFilter.hideFlags = HideFlags.HideAndDontSave;

            m_MeshRenderer = GetComponent <MeshRenderer>();
            if (!m_MeshRenderer)
            {
                m_MeshRenderer = gameObject.AddComponent <MeshRenderer>();
            }
            m_MeshRenderer.hideFlags = HideFlags.HideAndDontSave;
        }
 static void ShapeModule_meshRenderer(JSVCall vc)
 {
     if (vc.bGet)
     {
         UnityEngine.ParticleSystem.ShapeModule _this = (UnityEngine.ParticleSystem.ShapeModule)vc.csObj;
         var result = _this.meshRenderer;
         JSMgr.datax.setObject((int)JSApi.SetType.Rval, result);
     }
     else
     {
         UnityEngine.MeshRenderer arg0 = (UnityEngine.MeshRenderer)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
         UnityEngine.ParticleSystem.ShapeModule _this = (UnityEngine.ParticleSystem.ShapeModule)vc.csObj;
         _this.meshRenderer = arg0;
         JSMgr.changeJSObj(vc.jsObjID, _this);
     }
 }
示例#60
0
    static int get_additionalVertexStreams(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.MeshRenderer obj = (UnityEngine.MeshRenderer)o;
            UnityEngine.Mesh         ret = obj.additionalVertexStreams;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index additionalVertexStreams on a nil value" : e.Message));
        }
    }