Beispiel #1
0
        public GameObject Create(string type)
        {
            GameObject      go   = new GameObject();
            CSpriteRenderer sr   = new CSpriteRenderer(SpriteContainer.Instance.Pixel);
            CTile           tile = new CTile((ETileType)Enum.Parse(typeof(ETileType), type));

            go.AddComponent <CSpriteRenderer>(sr);
            go.AddComponent <CTile>(tile);

            sr.LayerDepth       = 0.0001f;
            go.Transform.Scale *= 1.0f;

            return(go);
        }
Beispiel #2
0
        private GameObject MadeTile(Vector2 pos, TextureSheet2D textureSheet)
        {
            GameObject      go   = new GameObject();
            CSpriteRenderer sr   = new CSpriteRenderer(textureSheet);
            CTile           tile = new CTile(TileSize);

            //CResourceTile resourceTile = new CResourceTile();

            sr.LayerDepth = 0f;

            go.AddComponent <CSpriteRenderer>(sr);
            go.AddComponent <CTile>(tile);
            //go.AddComponent<CResourceTile>(resourceTile);

            go.Transform.Position = new Vector2((int)pos.X, (int)pos.Y) * TileSize;
            go.Transform.Scale    = new Vector2(1.0f, 1.0f);

            myScene.Instantiate(go);
            return(go);
        }