コード例 #1
0
        // Start is called before the first frame update
        // We're not doing anything special at Start
        // So we can comment this out
        // void Start()
        // {
        //   doInitialization();
        // }

        // When you implement an abstract method, you must declare it as an _override_
        public override bool DoControl(MystControl control)
        {
            if (control == controls[currentIndex])
            {
                currentIndex++;

                if (currentIndex == controls.Length)
                {
                    isComplete = true;
                    DoComplete();
                }

                return(showProgress);
            }
            else
            {
                if (resetOnMistake)
                {
                    currentIndex = 0;
                    ResetControls();
                }

                return(false);
            }
        }
コード例 #2
0
        public override bool DoControl(MystControl control)
        {
            // This is the easier-to-read version for beginners
            // if (control.gameObject == confirmationButton || !requireConfirmation)
            // {
            //   isCorrect = true;
            // } else {
            //   isCorrect = false;
            // }

            // this is the slick version
            isCorrect = control.gameObject == confirmationButton || !requireConfirmation;

            if (isCorrect)
            {
                for (int i = 0; i < controls.Length; i++)
                {
                    MystControl_Tumbler c = controls[i] as MystControl_Tumbler;
                    isCorrect &= (c.currentState == combination[i]);
                }
            }

            if (isCorrect)
            {
                DoComplete();
            }

            return(isCorrect);
        }
コード例 #3
0
 public override bool DoControl(MystControl control)
 {
     return(true);
 }
コード例 #4
0
        // Start is called before the first frame update
        // We're not doing anything special at Start
        // So we can comment this out
        // void Start()
        // {
        //   doInitialization();
        // }

        public override bool DoControl(MystControl control)
        {
            isToggled = !isToggled;
            DoComplete();
            return(isToggled);
        }
コード例 #5
0
 // Mark any methods you will want to override with _abstract_
 public abstract bool DoControl(MystControl control);