//This function ensures that the object is not destructed in between scenes
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(this.gameObject);
        }
        else
        {
            Destroy(this.gameObject);
            return;
        }


        //When creating the game data, set the iteration to one (one card)
        // initialise this here is to make sure this get set
        // before it is being used in the start of moveAvatar.cs
        mainLog   = GameObject.Find("MainLogging").GetComponent <MainLogging>();
        Iteration = mainLog.GetLastSavedLevel() + 1;

        extRes = GameObject.Find("LoadExternalResources").GetComponent <LoadExternalResources>();

        // loading the question randomly
        //Ordering = Enumerable.Range(0, extRes.MemoryImages.Length).ToArray();
        //Shuffle(Ordering); //Shuffle the cards

        ArrangeGrid(Iteration);
        // load the question based on the stats
        //Ordering = GetNewOrdering();
    }
Beispiel #2
0
    void Start()
    {
        //Find all the necessary the Game Objects
        gameData   = GameObject.Find("GameData").GetComponent <GameDataScript>();
        logInfo    = GameObject.Find("ProfileInfo").GetComponent <LogInfo>();
        extRes     = GameObject.Find("LoadExternalResources").GetComponent <LoadExternalResources>();
        mrps       = GameObject.Find("MemRepeatPlaySound").GetComponent <MemRepeatPlaySound>();
        quitButton = GameObject.Find("QuitButton").GetComponent <Button>();

        //Retrieve ordering of the images, all the resources should have already been loaded
        //ordering = gameData.Ordering;
        // the iteration has increased at the end of the recalled scene, so -1 to bring it back to the actual level
        //questionNo = gameData.Iteration - 1;

        // an ID randomly chosen from the last seen set of questions
        int chosen = gameData.MemRepeatID; // start counting from 0

        MemoryCard.sprite = extRes.MemoryImages[chosen];
        targetSound       = extRes.MemorySounds[chosen];
        targetText        = extRes.MemoryWords[chosen];

        TranscriptionText.text = targetText;
        RecordingText.text     = "";

        StartCoroutine(PlayTargetSound());
#if UNITY_ANDROID && !UNITY_EDITOR
        // Opie looks down at the belly
        Opie.instance().head().set_linked_pose_and_eye_position(0.5f, 0.0f, Opie.Head.transition_action());
#endif
    }
    // Use this for initialization
    void Start()
    {
        //Find the object containing  profile information
        logInfo = GameObject.Find("ProfileInfo").GetComponent <LogInfo>();
        mainLog = GameObject.Find("MainLogging").GetComponent <MainLogging>();

#if UNITY_ANDROID && !UNITY_EDITOR
        //Stop idle motion
        Opie.instance().behaviours("idle_motion").stop(Opie.Behaviour.instant_action());
#endif
        extRes = GameObject.Find("LoadExternalResources").GetComponent <LoadExternalResources>();

        //If the resources folder for the selected language does not contain pictures/words subfolder,
        //then deactivate the Memory Game and Repetition Game
        // if ((Resources.LoadAll(language+"/pictures")).Length == 0){
        if (!extRes.CheckIfPicturesExist())
        {
            TextMemory.enabled = false;
            ButtonMemory.SetActive(false);
            TextRepetition.enabled = false;
            ButtonRepetition.SetActive(false);
        }
        //If the resource folder does not contain a Story subfolder, deactivate the story activity
        //if((Resources.LoadAll(language+"/story")).Length == 0){
        if (!extRes.CheckIfStoryExist())
        {
            TextStory.enabled = false;
            ButtonStory.SetActive(false);
        }
    }
Beispiel #4
0
 private void Awake()
 {
     quitButton = GameObject.Find("QuitButton").GetComponent <Button>();
     logInfo    = GameObject.Find("ProfileInfo").GetComponent <LogInfo>();
     sps        = GameObject.Find("StoryPlaySound").GetComponent <StoryPlaySound>();
     // this code load resources from an external folder at run time
     extRes = GameObject.Find("LoadExternalResources").GetComponent <LoadExternalResources>();
     //images = extRes.StoryImages;
     //sounds = extRes.StorySounds;
     //masks = extRes.StoryMasks;
 }
Beispiel #5
0
    private void Awake()
    {
        quitButton = GameObject.Find("QuitButton").GetComponent <Button>();
        logInfo    = GameObject.Find("ProfileInfo").GetComponent <LogInfo>();
        language   = logInfo.LanguageName;

        // this code load resources from an external folder at run time
        extRes = GameObject.Find("LoadExternalResources").GetComponent <LoadExternalResources>();
        images = extRes.MemoryImages;
        sounds = extRes.MemorySounds;
        words  = extRes.MemoryWords;
    }
    // Use this for initialization
    void Start()
    {
        //Find the objects containing the game data and the profile information
        gameData   = GameObject.Find("GameData").GetComponent <GameDataScript>();
        logInfo    = GameObject.Find("ProfileInfo").GetComponent <LogInfo>();
        extRes     = GameObject.Find("LoadExternalResources").GetComponent <LoadExternalResources>();
        quitButton = GameObject.Find("QuitButton").GetComponent <Button>();
        //goButton = GameObject.Find("GoButton").GetComponent<Button>();
        restartBtn = GameObject.Find("RestartButton").GetComponent <Button>();

        // move the loading resources to here to hide loading time
        // only load if not loaded
        if (!extRes.IsLoaded())
        {
            resourcesLoaded = false;
            startTime       = Time.realtimeSinceStartup;
            extRes.LoadMemoryGameResources();
            restartBtn.interactable = false;
            goButton.interactable   = false;
        }
        else
        {
            goButton.interactable   = true;
            restartBtn.interactable = true;
        }



        //Quit the application if the player has reached the last level
        if (gameData.Iteration > gameData.TotalLevel)
        {
            QuitApp();
        }


        if (gameData.Iteration == 1)
        {
            restartBtn.gameObject.SetActive(false);
        }
        else
        {
            restartBtn.gameObject.SetActive(true);
        }

        //Display the name of the user
        TextWritten.text = logInfo.PlayerName;
#if UNITY_ANDROID && !UNITY_EDITOR
        //Get Opie to look down at its tummy to observe progress
        Opie.instance().head().set_eye_type(EyeType.NEUTRAL, Opie.Head.instant_action());
        Opie.instance().head().set_linked_pose_and_eye_position(0.5f, 0.0f, Opie.Head.transition_action());
#endif
    }
Beispiel #7
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
         return;
     }
 }
    void Start()
    {
        //Find all the necessary the Game Objects
        gameData     = GameObject.Find("GameData").GetComponent <GameDataScript>();
        logInfo      = GameObject.Find("ProfileInfo").GetComponent <LogInfo>();
        originalCard = GameObject.Find("Memory Card").GetComponent <MemoryCardRecall>();
        originalStar = GameObject.Find("Star").GetComponent <Star>();
        extRes       = GameObject.Find("LoadExternalResources").GetComponent <LoadExternalResources>();
        rps          = GameObject.Find("RecallPlaySound").GetComponent <RecallPlaySound>();
        quitButton   = GameObject.Find("QuitButton").GetComponent <Button>();
        mainLog      = GameObject.Find("MainLogging").GetComponent <MainLogging>();


#if UNITY_ANDROID && !UNITY_EDITOR
        //Opie looks up with NEUTRAL emotion
        Opie.instance().head().set_eye_type(EyeType.NEUTRAL, Opie.Head.instant_action());
        Opie.instance().head().set_linked_pose_and_eye_position(0.5f, 0.5f, Opie.Head.transition_action());
#endif

        //Retrieve ordering of the images, all the resources should have already been loaded
        ordering = gameData.Ordering;

        images   = extRes.MemoryImages;
        sounds   = extRes.MemorySounds;
        words    = extRes.MemoryWords;
        noOfCard = gameData.NRows * gameData.NCols / 2;

        //Shuffle the order of the cards to be Question
        questions = Enumerable.Range(0, noOfCard).ToArray();

        Shuffle(questions);

        answers = new int[noOfCard];
        for (int i = 0; i < noOfCard; i++)
        {
            answers[i] = ordering[questions[i]];
        }

        CardsSetup();

        //Initializing the vectors of correct and incorrect answers
        correct        = new List <string>();
        incorrect      = new List <string>();
        oneShotCorrect = new List <string>();
        //mcbn.GetComponent<Button>().interactable = false;

        DeactivateAllCards();
        //Present the first word (sound + transcription)
        NextQuestion();
    }
    void Start()
    {
        //Find all the necessary the Game Objects
        logInfo      = GameObject.Find("ProfileInfo").GetComponent <LogInfo>();
        originalStar = GameObject.Find("Star").GetComponent <Star>();
        extRes       = GameObject.Find("LoadExternalResources").GetComponent <LoadExternalResources>();
        wrps         = GameObject.Find("WordRepPlaySound").GetComponent <WordRepPlaySound>();
        quitButton   = GameObject.Find("QuitButton").GetComponent <Button>();
        mainLog      = GameObject.Find("MainLogging").GetComponent <MainLogging>();

        //Set language name and load resources for it
        language = logInfo.LanguageName;
        images   = extRes.MemoryImages;
        sounds   = extRes.MemorySounds;
        words    = extRes.MemoryWords;

        /*
         * questions = Enumerable.Range(0, images.Length).ToArray();
         * Shuffle(questions);
         */

        questions = WordsStats.GetOrderingPerformanceBased(mainLog.GetRepetitionSeenWordsStats(),
                                                           extRes.MemoryWords, totalLevel);

        Vector3 startPosStar = originalStar.transform.position;

        stars = new List <Star>();

        for (int i = 0; i < totalLevel; i++)
        {
            Star star;
            if (i == 0)
            {
                star = originalStar;
            }
            else
            {
                star = Instantiate(originalStar) as Star;
            }

            float posXstar = ((offsetX + star.GetComponent <BoxCollider2D>().bounds.size.y) * i) + startPosStar.x;
            star.transform.position = new Vector3(posXstar, startPosStar.y, startPosStar.z);
            stars.Add(star);
        }

        NextQuestion();
    }