Пример #1
0
 public override void Init(ETileObjectType type, int x, int y, string[] args)
 {
     base.Init(type, x, y, args);
     this.RegisterAsListener("BinSpawner", typeof(BinSpawnEvent));
     m_BinPrefab  = RessourceManager.LoadPrefab("TileObject_Bin");
     ms_BinNumber = 0;
     m_Animator   = GetComponent <Animator> ();
 }
Пример #2
0
    public override void Init(ETileObjectType type, int x, int y, string[] args)
    {
        base.Init(type, x, y, args);
        m_Number = Int32.Parse((String)args.GetValue(0));
        GameObject numberObject = GameObject.Instantiate(RessourceManager.LoadPrefab("number"));

        numberObject.transform.SetParent(transform, false);
        numberObject.GetComponent <SpriteRenderer> ().sprite = RessourceManager.LoadSprite("number-" + (m_Number + 1), 0);
        GoalManagerProxy.Get().RegisterBin(this);
    }
Пример #3
0
    public static TileCoordinates GenLevel(string filename)
    {
        filename = Application.streamingAssetsPath + filename;

        string[] lines = File.ReadAllLines(filename);
        int      x     = 0;
        int      y     = 0;

        foreach (string line in lines)
        {
            string[] lienOfTile = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
            x = 0;
            foreach (string tileInfo in lienOfTile)
            {
                string[] words = tileInfo.Split(',');

                ETileType tileType = ms_CharToTileType[words[0]];
                if (tileType == ETileType.None)
                {
                    x++;
                    continue;
                }
                GameObject tileGameObject = GameObject.Instantiate(RessourceManager.LoadPrefab("Tile"));
                tileGameObject.transform.position = new Vector3(x.ToWorldUnit(), y.ToWorldUnit(), 0);
                Tile tile = tileGameObject.AddComponent <Tile> ();
                tile.SetCoordinates(new TileCoordinates(x, y));
                tile.SetType(tileType);

                TileManagerProxy.Get().AddTile(tile);

                if (words.Length > 1)
                {
                    ETileObjectType tileObjectType       = (ETileObjectType)Enum.Parse(typeof(ETileObjectType), (String)words.GetValue(1), true);
                    GameObject      tileObjectGameObject = GameObject.Instantiate(RessourceManager.LoadPrefab("TileObject_" + words[1]));
                    tileObjectGameObject.transform.position = new Vector3(x.ToWorldUnit(), y.ToWorldUnit(), 0);
                    TileObject tileObject = tileObjectGameObject.GetComponent <TileObject> ();
                    tileObject.Init(tileObjectType, x, y, words.SubArray(2, -1));
                    tile.SetTileObject(tileObject);
                }

                x++;
            }
            y--;
        }

        return(new TileCoordinates(x, y));
    }
Пример #4
0
 public SpawnLevelOrder(string[] args, float time) : base(time)
 {
     foreach (string order in args)
     {
         string[] things = order.Split('*');
         string   prefab;
         int      num = 1;
         if (things.Length > 1)
         {
             num    = int.Parse(things[0]);
             prefab = things[1];
         }
         else
         {
             prefab = things[0];
         }
         m_Entities.Add(RessourceManager.LoadPrefab(prefab));
         m_EntitiesQuantity.Add(num);
     }
 }