private void DrawActivators()
            {
                if (GUILayout.Button("Add Stage activator"))
                {
                    if (stageActivators.Count >= stages.Count - 1)
                    {
                        DLog.LogError(string.Format(
                                          "Cannot add stage activator because stage activator count is {0} and stage count is {1}",
                                          stageActivators.Count, stages.Count
                                          ));
                        return;
                    }

                    StageActivator sa = new StageActivator();
                    stageActivators.Add(sa);
                }

                StageActivator removedSa = null;

                for (int kIndex = 0; kIndex < stageActivators.Count; kIndex++)
                {
                    StageActivator sa = stageActivators[kIndex];
                    sa.SetOrder(kIndex + 1);
                    sa.OnGUI();
                    if (sa.IsRemoved)
                    {
                        removedSa = sa;
                    }
                }

                if (removedSa != null)
                {
                    stageActivators.Remove(removedSa);
                }
            }
Exemplo n.º 2
0
        public void StartUp()
        {
            //DLog.Log("Dungeon start up");
            foreach (Component component in components)
            {
                component.StartUp();
            }

            CheckStagesIsConfigProperly();
            activeStage          = stages[0];
            activeStageComponent = new StageComponent(activeStage);
            AddComponent(activeStageComponent);

            CheckStageCountMatchGateCount();
            if (gates.Count > 0)
            {
                activeGateController = gates[0];
            }

            CheckStageCountMatchStageActivatorCount();
            if (stageActivators.Count > 0)
            {
                activeStageActivator = stageActivators[0];
            }

            activeStage.OnStart();
            activeStage.ListenToWaveCycle(OnWaveCycle);

            DungeonActionComponent actionComponent = new DungeonActionComponent(actions);

            AddComponent(actionComponent);
        }
Exemplo n.º 3
0
        private void WaitForStageActivatorToActiveThenMoveToNextStage()
        {
            if (!activeStageActivator.IsActive())
            {
                return;
            }

            isGateOpenedLastTimeCheck = false;
            //close and seal the gate so that it would not be opened again
            //DLog.Log("Close gate");
            activeGateController.Close();
            activeGateController.Seal();

            int indexOfActiveStageActivator = stageActivators.IndexOf(activeStageActivator);

            if (indexOfActiveStageActivator < stageActivators.Count - 1)
            {
                activeStageActivator = stageActivators[indexOfActiveStageActivator + 1];
                components.Remove(activeStageActivatorComponent);
            }

            int indexOfActiveGate = gates.IndexOf(activeGateController);

            if (indexOfActiveGate < gates.Count - 1)
            {
                activeGateController = gates[indexOfActiveGate + 1];
//				components.Remove(activeGateComponent);
            }

            MoveToNextStage();
        }
Exemplo n.º 4
0
        public void AddStageActivator(StageActivator stageActivator)
        {
            notNullReference.Check(stageActivator, "stageActivator");

            stageActivators.Add(stageActivator);
        }
        public StageActivatorComponent(StageActivator stageActivator)
        {
            new NotNullReference().Check(stageActivator, "stageActivator");

            this.stageActivator = stageActivator;
        }