Beispiel #1
0
 void Start()
 {
     Stack                    = new CompletionStack <Completable>(new List <Completable>(Completables), true);
     Stack.OnCancel          += c => MDebug.Log("cancelled " + c);
     Stack.OnComplete        += c => MDebug.Log("complete " + c + "   " + c.press_to_complete);
     Stack.OnCurrentComplete += c => MDebug.Log("current complete " + c);
     Stack.OnSetNew          += c => MDebug.Log("set new " + c + "   " + c.press_to_complete);
     Stack.Init();
 }
Beispiel #2
0
    public virtual void Init(List <ObjectiveConfig> _objectives)
    {
        if (ResetOnStart)
        {
            ResetSaves();
        }

        SetSaves(DebugStartAt);

        List <Objective> objectives = new List <Objective>();
        GameObject       newGO      = new GameObject("objective ");

        newGO.transform.parent = this.transform;
        int index = 0;

        _objectives
        .Where(obj => !obj.Condition.GetHasCompletedInSave()).ToList()
        .ForEach(obj => {
            Objective objective = newGO.AddComponent <Objective>();
            objectives.Add(objective);
            objective.Init(obj, CanComplete, index);
            index++;
        });



        Objectives = new CompletionStack <Objective>(objectives, CompleteAny);

        if (CompleteAny)
        {
            Objectives.OnComplete += OnObjectiveComplete;
        }
        else
        {
            Objectives.OnCurrentComplete += OnObjectiveComplete;
        }

        Objectives.OnSetNew += OnSetNew;
        Objectives.Init();

        /// objectives.ForEach(objective => objective.SetActive());
    }