protected override void Awake()
        {
            base.Awake();

            if (ColorScheme == null)
            {
                ColorScheme = (DataColorScheme)Resources.Load(ManagerCGridGame.I.CGridDataPath + "/" + DefaultNameColorScheme, typeof(ScriptableObject));
            }
            if (ColorScheme == null)
            {
                Debug.LogError("Set DataColorScheme", this);
            }

            if (DataCellsStates == null)
            {
                DataCellsStates = (DataCellStates)Resources.Load(ManagerCGridGame.I.CGridDataPath + "/" + DefaultNameCellStates, typeof(ScriptableObject));
            }
            if (DataCellsStates == null)
            {
                Debug.LogError("Set DataCellsStates", this);
            }

            if (CampaignData == null)
            {
                Debug.LogError("No CampaignData set", this);
                CampaignData = Resources.FindObjectsOfTypeAll <DataCampaign>().FirstOrDefault();
            }
            LevelData = CampaignData.LevelsData[CampaignData.CurrentLevel];
            //if (LevelData == null) {
            //    Debug.LogError("No DataLevel set. Creating new one", this);
            //    LevelData = DataLevel.CreateInstance<DataLevel>();
            //}
        }
Ejemplo n.º 2
0
        private void CreateItem(int number, DataLevel levelData)
        {
            var inst = Instantiate(LevelPrefab, ParentTransform);

            inst.Construct(number, levelData.MatrixLength);
        }