예제 #1
0
    void Awake()
    {
        level = levelFileNames[Random.Range(0, levelFileNames.Count - 1)];
        Grid  = JSONGeneric.Load <Level>(level).Grid;

        for (int i = 0; i < Grid.GetLength(0); i++)
        {
            for (int j = 0; j < Grid.GetLength(1); j++)
            {
                var objectType       = Grid[i, j];
                var gridObjectPrefab = BaseGridObjectsPrefabs[objectType];
                var gridObjectClone  = Instantiate(gridObjectPrefab);
                gridObjectClone.GridPosition       = new IntVector2(j, -i);
                gridObjectClone.transform.position = new Vector3(gridObjectClone.GridPosition.x, gridObjectClone.GridPosition.y, 0f);
                //Instantiate(BaseGridObjectsPrefabs[Grid[i,j]], new Vector3(j , -i, 0), Quaternion.identity);
            }
        }
    }
예제 #2
0
    private void OnEnable()
    {
        var enemy = JSONGeneric.Load <JSONEnemy>("Enemy111111");

        JSONGeneric.Save(enemy1, "Enemy1");
    }