コード例 #1
0
        public override ProgrammingElement Clone()
        {
            GameScoredSensor clone = new GameScoredSensor();

            CopyTo(clone);
            return(clone);
        }
コード例 #2
0
        public override bool MatchAction(Reflex reflex, out object param)
        {
            param = null;
            bool match = false;

            if (reflex.targetSet != null && reflex.targetSet.Param != null)
            {
                GameScoredSensor      sensor = reflex.Sensor as GameScoredSensor;
                Classification.Colors color  = (Classification.Colors)reflex.targetSet.Param;

                int curr = 0, prev;

                Scoreboard.Score score = sensor.GetScore(color);

                if (score != null)
                {
                    curr = score.Curr;
                    prev = score.Prev;

                    // If the score changed and jumped across or landed on the trigger score
                    if ((prev != curr) &&
                        ((prev < scoreTriggerValue && curr >= scoreTriggerValue) ||
                         (prev > scoreTriggerValue && curr <= scoreTriggerValue)))
                    {
                        match = true;
                    }
                }
            }
            return(match);
        }
コード例 #3
0
 protected void CopyTo(GameScoredSensor clone)
 {
     base.CopyTo(clone);
 }