示例#1
0
    public GroundDataInfo ToGroundDataInfo()
    {
        GroundDataInfo data = new GroundDataInfo ();
        data.m_Sprite = GetComponent<SpriteRenderer> ().sprite;
        data.m_Position = transform.localPosition;
        data.m_Scale = transform.localScale;
        data.m_Rotation = transform.localRotation;

        return data;
    }
示例#2
0
    public GroundDataInfo ToGroundDataInfo()
    {
        GroundDataInfo data = new GroundDataInfo();

        data.m_Sprite   = GetComponent <SpriteRenderer> ().sprite;
        data.m_Position = transform.localPosition;
        data.m_Scale    = transform.localScale;
        data.m_Rotation = transform.localRotation;

        return(data);
    }
示例#3
0
    void CreateGround(GameObject mapContainer, List <GroundDataInfo> aGroundDataInfo)
    {
        GameObject container = new GameObject();

        container.name = "GroundContainer";
        container.transform.SetParent(mapContainer.transform, false);

        for (int i = 0; i < aGroundDataInfo.Count; i++)
        {
            GroundDataInfo groundDataInfo = aGroundDataInfo[i];

            GameObject ground = new GameObject();
            ground.name = GROUND_NAME + i;
            ground.transform.SetParent(container.transform, false);

            SpriteRenderer spriteRenderer = ground.AddComponent <SpriteRenderer>();
            spriteRenderer.sprite = groundDataInfo.m_Sprite;

            ground.transform.localPosition = groundDataInfo.m_Position;
            ground.transform.localScale    = groundDataInfo.m_Scale;
            ground.transform.localRotation = groundDataInfo.m_Rotation;
        }
    }