using UnityEngine;
using System.Collections;

public class ProcessWin : Process {

    [SerializeField]
    private GameObject scene;

    private bool needChangeState = false;

    public override void BeforeActivation()
    {
        base.BeforeActivation();

        for (int i=0; i<scene.transform.childCount; i++)
        {
            Destroy(scene.transform.GetChild(i).gameObject);
        }

    }

    public override void AfterActivation()
    {
        base.AfterActivation();


        GameData.instance.SetLevelScore(LevelReader.instance.currentLevelName);

        needChangeState = true;
    }

    public void Update()
    {
        if(needChangeState)
        {
            needChangeState = false;
            StateMachine.instance.UpdateState(StateMachine.STATE.LISTOFLEVELS);
        }

    }

}
