public void SetDeathMaterial(string name) { Material mtl = CustomMaterialManager.Instance.GetMaterial(name); Renderer renderer = mVisual.GetRenderer(); if (mtl == null || renderer == null) { return; } MaterialObjTask mtlTask = null; switch (name) { case "burn_out": case "poison": mtlTask = new BurnMaterialObjTask(this, name); break; default: mtlTask = new MaterialObjTask(this, name); break; } AddMaterialTask(mtlTask); // f_deadTime = 0; // mDeadMtl = new List<Material>(); //for(int i=0; i < renderer.sharedMaterials.Length; ++i) //{ // Material originalmtl = renderer.sharedMaterials[i]; // Material mtlInstance = Object.Instantiate(mtl) as Material; // mtlInstance.mainTexture = originalmtl.mainTexture; // mtlInstance.SetFloat("_startTime", Time.timeSinceLevelLoad); // mtlInstance.SetVector("_worldOrigin", mVisual.Visual.transform.position); // mtlInstance.SetFloat("_maxHeight", renderer.bounds.extents.y); // mDeadMtl.Add(mtlInstance); //} //mOriginalMtl = renderer.sharedMaterials; //renderer.materials = mDeadMtl.ToArray(); }