Exemplo n.º 1
0
            /// <summary>
            /// Initializes a new instance of the <see cref="AnyBall.Rule.CS_RuleSet"/> class.
            /// </summary>
            /// <param name="g_rule">the rule to initialize with.</param>
            public CS_RuleSet(CS_Rule g_rule)
            {
                myRules = new List <CS_Rule> ();
                myRules.Add(g_rule);

                myRuleInfo = g_rule.GetInfo();
            }
Exemplo n.º 2
0
            public bool CheckCombine(CS_Rule g_rule)
            {
                //cannot combine the same rule
                foreach (CS_Rule f_rule in myRules)
                {
                    if (f_rule.gameObject.name == g_rule.gameObject.name)
                    {
                        return(false);
                    }
                }

                if (myRuleInfo.myScoreType == ScoreType.Keeping || g_rule.GetInfo().myScoreType == ScoreType.Keeping)
                {
                    return(false);
                }

                if (myRuleInfo.myScoreType == ScoreType.Trigger && g_rule.GetInfo().myScoreType == ScoreType.Trigger)
                {
                    return(false);
                }

                return(true);
            }
Exemplo n.º 3
0
            /// <summary>
            /// Adds the rule to rule set.
            /// </summary>
            /// <returns><c>true</c>, if rule was added, <c>false</c> otherwise.</returns>
            /// <param name="g_rule">rule you want to add.</param>
            public bool AddRule(CS_Rule g_rule)
            {
                if (CheckCombine(g_rule) == false)
                {
                    return(false);
                }

                myRules.Add(g_rule);
                SetInfo(g_rule.GetInfo());

                //update the extendable in the sequence
                //fix : if hat + football + footbal, the 2nd football should be added to the sequence
                myRuleSequence.UpdateExtendable();

                return(true);
            }