Ejemplo n.º 1
0
    public void Save(string fileName)
    {
        LevelGoalData goalData = _gameManager.GetComponent <LevelGoal>().ForSave();
        LevelDataSO   data     = CreateAsset <LevelDataSO>(fileName);

        data.boardSettings = _board.settings;

        if (goalData.GetType() == typeof(CollectedGoalData))
        {
            data.collectedGoal    = (CollectedGoalData)goalData;
            data.collectedEnabled = true;
        }
        else if (goalData.GetType() == typeof(TimedGoalData))
        {
            data.timedGoal    = (TimedGoalData)goalData;
            data.timedEnabled = true;
        }
        else
        {
            data.scoreGoal    = goalData;
            data.scoreEnabled = true;
        }

        EditorUtility.SetDirty(data);
    }
Ejemplo n.º 2
0
    override public void Load(LevelGoalData data)
    {
        TimedGoalData casted = data as TimedGoalData;

        if (casted != null)
        {
            timeLeft = casted.timeLeft;
        }
        base.Load(data);
    }
Ejemplo n.º 3
0
    override public void Load(LevelGoalData data)
    {
        CollectedGoalData casted = data as CollectedGoalData;

        if (casted != null)
        {
            int count = casted.goalPrefabs.Count;
            collectionGoals = new CollectionGoal[count];
            for (int i = 0; i < count; i++)
            {
                CollectionGoal g = new GameObject().AddComponent <CollectionGoal>();
                g.transform.parent = transform;
                g.prefabToCollect  = casted.goalPrefabs[i];
                g.numberToCollect  = casted.goalQuantities[i];
                collectionGoals[i] = g;
            }
        }
        base.Load(data);
    }
Ejemplo n.º 4
0
 public virtual void Load(LevelGoalData data)
 {
     movesLeft  = data.movesLeft;
     scoreGoals = (int[])data.scoreGoals.Clone();
 }
Ejemplo n.º 5
0
 protected LevelGoalData BaseForSave(LevelGoalData data)
 {
     data.scoreGoals = (int[])scoreGoals.Clone();
     data.movesLeft  = movesLeft;
     return(data);
 }