public void DestoryTextrue(FloorTexture t, FloorTextureType tt) { if (t != null) { t.DestroyTexture(tt); FloorTexture[] ftChilds = t.gameObject.GetComponentsInChildren<FloorTexture> (); foreach (FloorTexture ft in ftChilds) if (ft != null) { ft.DestroyTexture(tt); } } }
public void DestroyTexture(FloorTextureType type) { if (m_CurrentType == FloorTextureType.Destory) { return; } //Debug.Log(gameObject + "," + type + "," + m_CurrentType ); switch (type) { case FloorTextureType.Left: if (m_CurrentType == FloorTextureType.Right) { gameObject.GetComponent <Renderer>().material.mainTexture = m_ttDestroyDestoryTexture; m_CurrentType = FloorTextureType.Destory; } else { gameObject.GetComponent <Renderer>().material.mainTexture = m_ttDestroyLeftTexture; m_CurrentType = type; } break; case FloorTextureType.Middle: /*if (m_CurrentType == FloorTextureType.Full) * gameObject.renderer.material.mainTexture = m_ttDestroyMiddleTexture; * else*/ gameObject.GetComponent <Renderer>().material.mainTexture = m_ttDestroyMiddleTexture; m_CurrentType = type; break; case FloorTextureType.Right: if (m_CurrentType == FloorTextureType.Left) { gameObject.GetComponent <Renderer>().material.mainTexture = m_ttDestroyDestoryTexture; m_CurrentType = FloorTextureType.Destory; } else { gameObject.GetComponent <Renderer>().material.mainTexture = m_ttDestroyRightTexture; m_CurrentType = type; } break; case FloorTextureType.DamageSmall: if (m_CurrentType == FloorTextureType.Full || m_CurrentType == FloorTextureType.DamageSmall || m_CurrentType == FloorTextureType.DamageMiddle) { gameObject.GetComponent <Renderer>().material.mainTexture = m_ttDamageSmallTexture; m_CurrentType = type; } break; case FloorTextureType.DamageMiddle: if (m_CurrentType == FloorTextureType.Full || m_CurrentType == FloorTextureType.DamageSmall || m_CurrentType == FloorTextureType.DamageMiddle) { gameObject.GetComponent <Renderer>().material.mainTexture = m_ttDamageMiddleTexture; m_CurrentType = type; } break; default: App.log.To("FloorTexture.cs", "unknow FloorTextureType"); break; } }
public void Start() { m_CurrentType = FloorTextureType.Full; }