Inheritance: MonoBehaviour
Exemple #1
0
    IEnumerator IEUpdateBoard()
    {
        EnableUpdateBoard(true);

        yield return(StartCoroutine(FindChainMatches()));

        if (GameController.timeLeft <= 0)
        {
            EnableUpdateBoard(false);
            yield break;
        }

        HintController.FindHints();
        if (!HintController.hasHints)
        {
            yield return(StartCoroutine(ShuffleBoard()));

            UpdateBoard();
        }
        else
        {
            EnableUpdateBoard(false);
            matchCounter = 0;
            HintController.StartHinting();
            if (EndUpdatingBoard != null)
            {
                EndUpdatingBoard();
            }
        }
    }
Exemple #2
0
    void Update()
    {
        if (state == GameState.Playing)
        {
            timeLeft -= Time.deltaTime;
            if (score >= currentGoalScore)
            {
                currentGoalScore += currentGoalScore + currentGoalScore / 2;
                timeLeft          = 120;
            }

            if (timeLeft <= 0)
            {
                GameOver();
            }
        }
    #if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.Space))
        {
            StartCoroutine(BoardController.instance.ShuffleBoard());
        }

        if (Input.GetKeyDown(KeyCode.H))
        {
            if (!HintController.isShowing)
            {
                HintController.ShowHint();
            }
            else
            {
                HintController.StopCurrentHint();
            }
        }
    #endif
    }
Exemple #3
0
 public virtual void Disable() {
     if(!used)
     {
         used = true;
         HintController hintController = GameObject.Find("GameLogic").GetComponent<HintController>();
         hintController.RestartTimer();
     }
 }
    public override void DoOutcome(ref NPC n)
    {
        HintController controller = GameObject.Find("LocationsOfInterest").GetComponent <HintController>();

        if (nextTask != null)
        {
            Debug.Log("Next task is === " + nextTask);
            controller.StartThisTask(nextTask);
        }
        if (autoNext)
        {
            controller.NextTask();
        }
    }
Exemple #5
0
    protected void Start()
    {
        LivesCount      = Lives.Length;
        BackgroundDelta = (Backgrounds[BackgroundRight].transform.position -
                           Backgrounds[BackgroundLeft].transform.position);
        stepsCompleted = 0;
        ConfigureFirstStep();

        superdogController = Superdog.GetComponent <SuperdogController>();
        vineController     = Vine.GetComponent <VineController>();
        dialogueController = SuperdogDialogue.GetComponent <DialogueController>();
        hintController     = hintObject.GetComponent <HintController>();

        vineController.InitializeVineLength(CurrentStep);
        StartCoroutine(InitializeSuperdog());
        sgVelocity = Vector3.zero;
    }
Exemple #6
0
    IEnumerator IEGameOver()
    {
        yield return(new WaitUntil(() => !BoardController.updatingBoard));

        if (timeLeft > 0)
        {
            gameOver = null;
            yield break;
        }

        TouchController.cancel = true;
        state = GameState.Menu;
        HintController.StopCurrentHint();
        HintController.StopHinting();
        UIController.ShowMsg("Game Over");
        yield return(new WaitForSeconds(BoardController.DestroyGems() + .5f));

        UIController.ShowMainScreen();
        gameOver = null;
    }
    // Use this for initialization
    void Start()
    {
        if (_instance == null)
        {
            _instance = this;
        }
        else
        {
            Debug.LogError("There is more than one Narration Controller! Destroying this one");
            Destroy(this);
        }

        _narrationContainer = Toolbox.Instance.mainCanvas.transform.Find("TextNarration").gameObject;
        _narrationText      = _narrationContainer.GetComponentInChildren <Text>();
        _narrationText.text = "";
        _narrationAnimator  = _narrationContainer.GetComponent <Animator>();
        _narrationContinue  = _narrationContainer.transform.Find("Continue").GetComponent <Image>();
        _narrationContinue.gameObject.SetActive(false);
        _narrationBackground = _narrationContainer.transform.Find("Background").GetComponent <Image>();
        _hintController      = Toolbox.Instance.mainCanvas.transform.Find("ControlHint").GetComponent <HintController>();

        CancelNarration();
    }
 private void Awake()
 {
     Instance = this;
 }
Exemple #9
0
    IEnumerator IETryMatch(BaseGem from, BaseGem to)
    {
        EnableUpdateBoard(true);
        yield return(StartCoroutine(IESwapGems(from, to)));

        MatchInfo matchFrom = from.GetMatch();
        MatchInfo matchTo   = to.GetMatch();

        if (!(matchFrom.isValid || matchTo.isValid))
        {
            yield return(StartCoroutine(IESwapGems(from, to)));

            EnableUpdateBoard(false);
        }
        else
        {
            HintController.StopCurrentHint();
            HintController.StopHinting();

            List <MatchInfo>  matches       = new List <MatchInfo>();
            List <Vector2Int> fallPositions = new List <Vector2Int>();

            matches.Add(matchFrom);
            matches.Add(matchTo);

            if (from.type == GemType.Special)
            {
                foreach (MatchInfo specialMatch in matchFrom.specialMatches)
                {
                    matches.Add(specialMatch);
                }
            }

            if (to.type == GemType.Special)
            {
                foreach (MatchInfo specialMatch in matchTo.specialMatches)
                {
                    matches.Add(specialMatch);
                }
            }

            foreach (var matchInfo in new List <MatchInfo>(matches))
            {
                if (matchInfo.isValid)
                {
                    fallPositions = MatchInfo.JoinFallPositions(
                        fallPositions, matchInfo.GetFallPositions()
                        );
                }
                else
                {
                    matches.Remove(matchInfo);
                }
            }

            // if(matchFrom.isValid) {
            //     matches.Add(matchFrom);
            //     fallPositions = MatchInfo.JoinFallPositions(
            //         fallPositions, matchFrom.GetFallPositions()
            //     );
            // }

            // if(matchTo.isValid) {
            //     matches.Add(matchTo);
            //     fallPositions = MatchInfo.JoinFallPositions(
            //         fallPositions, matchTo.GetFallPositions()
            //     );
            // }

            yield return(StartCoroutine(DestroyMatchedGems(matches)));

            yield return(StartCoroutine(FallGems(fallPositions)));

            UpdateBoard();
        }
    }
 public StepHintEventArgs(StepController sender, HintController hintController)
 {
     Sender         = sender;
     HintController = hintController;
 }
    public void Initialize(GameObject hintButton, ArduinoLetterController arduinoLetterController)
    {
        this.arduinoLetterController = arduinoLetterController;
                usersMostRecentChanges = new char[UserInputRouter.numOnscreenLetterSpaces];

                lockedPositionHandler = gameObject.GetComponent<LockedPositionHandler> ();

                hintController = gameObject.GetComponent<HintController> ();
                hintController.Initialize (hintButton);

                SetUpNextProblem ();

                excellent = InstructionsAudio.instance.excellent;
                incorrectSoundEffect = InstructionsAudio.instance.incorrectSoundEffect;
                notQuiteIt = InstructionsAudio.instance.notQuiteIt;
                offerHint = InstructionsAudio.instance.offerHint;
                youDidIt = InstructionsAudio.instance.youDidIt;
                correctSoundEffect = InstructionsAudio.instance.correctSoundEffect;
                removeAllLetters = InstructionsAudio.instance.removeAllLetters;

                triumphantSoundForSessionDone = InstructionsAudio.instance.allDoneSession;
    }
Exemple #12
0
 void Start()
 {
     Test();
     player         = GameObject.FindGameObjectWithTag("Player");
     hintController = GameObject.FindGameObjectWithTag("HintController").GetComponent <HintController>();
 }
 public void SetHint(RectTransform rt)
 {
     HintController hc = rt.gameObject.AddComponent <HintController>();
 }