コード例 #1
0
 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);
             }
     }
 }
コード例 #2
0
    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;
        }
    }
コード例 #3
0
 public void Start()
 {
     m_CurrentType = FloorTextureType.Full;
 }