Ejemplo n.º 1
0
        public void Initialize(GenerativeData generativeData, int difficulty)
        {
            sectionState = new FiniteStateMachine()
            {
                debug = true
            };
            sectionState.SetState(
                "READY",
                (previousState) => { },
                () => { },
                (nextState) => { });
            sectionState.SetState(
                "ACTIVE",
                (previousState) => { },
                () => { },
                (nextState) => { });
            sectionState.SetState(
                "COMPLETED",
                (previousState) => { },
                () => { },
                (nextState) => { });
            sectionState.ChangeState("READY");

            // Generate everything
        }
Ejemplo n.º 2
0
        public void Initialize(GenerativeData generativeData)
        {
            m_generativeData = generativeData;

            runState = new FiniteStateMachine()
            {
                debug = true
            };
            runState.SetStateData("READY");
            runState.SetState("RUNNING",
                              (previousState) =>
            {
                for (int i = 0; i < generatedSectionsAtBeginning; i++)
                {
                    GameObject sgo    = Instantiate(sectionPrefab);
                    SectionManager sm = sgo.GetComponent <SectionManager>();
                    sm.Initialize(m_generativeData, 0);

                    sections.Add(sm);
                }

                sections[0].BeginSection();
                currentSection = 0;
            },
                              () => { },
                              (nextState) => { });
            runState.SetStateData("ENDED");
            runState.ChangeState("READY");
        }