Exemplo n.º 1
0
    void AddChunk()
    {
        var t = pool.GetObject();

        t.parent = transform;
        float x = 0;

        if (chunks.Count > 0)
        {
            x = chunks[chunks.Count - 1].localPosition.x + chunks[chunks.Count - 1].GetComponent <tk2dSprite>().GetBounds().size.x;
        }
        t.localPosition = Vector3.right * x;
        chunks.Add(t);
        if (!isStart)
        {
            if (spawner != null)
            {
                spawner.OnChunkAdded(t);
            }
        }
    }