Exemplo n.º 1
0
        // the flag has been taken. Deactivate the flag not taken behaviors and activate the flag taken behaviors
        public bool flagTaken()
        {
            // return if the flag is already taken
            if (isFlagTaken)
            {
                return(false);
            }

            // deactivate the flag not taken behaviors
            for (int i = 0; i < flagNotTakenBehaviors.Count; ++i)
            {
                if (behaviorManager.isBehaviorEnabled(flagNotTakenBehaviors[i]))
                {
                    behaviorManager.disableBehavior(flagNotTakenBehaviors[i]);
                }
            }

            // acctivate the flag taken behaviors
            for (int i = 0; i < flagTakenBehaviors.Count; ++i)
            {
                behaviorManager.enableBehavior(flagTakenBehaviors[i]);
            }

            // the flag is taken
            isFlagTaken = true;
            return(true);
        }