示例#1
0
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //	* New Method: Clone Tile
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#if UNITY_EDITOR
    private void CloneTo(int X, int Y)
    {
        if (LevelGrid.ValidTile(X, Y))
        {
            TileDisplay pTile = GameObject.Find("Level Map").transform.GetChild(X).GetChild(Y).GetComponent <TileDisplay>();
            pTile.ChangeTileType(m_eTileType);

            if (gameObject.GetComponent <SpriteRenderer>() != null)
            {
                pTile.GetComponent <SpriteRenderer>().sprite = gameObject.GetComponent <SpriteRenderer>().sprite;
            }
            if (gameObject.GetComponent <PlatformInformation>() != null)
            {
                pTile.GetComponent <PlatformInformation>().m_eDirectionType = gameObject.GetComponent <PlatformInformation>().m_eDirectionType;
                pTile.GetComponent <PlatformInformation>().m_bBreakable     = gameObject.GetComponent <PlatformInformation>().m_bBreakable;
                pTile.GetComponent <PlatformInformation>().m_bCanDash       = gameObject.GetComponent <PlatformInformation>().m_bCanDash;
            }
            if (Child != null)
            {
                pTile.AddChild();
                pTile.Child.GetComponent <SpriteRenderer>().sprite = Child.GetComponent <SpriteRenderer>().sprite;
            }
        }
    }