예제 #1
0
    //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();
    }
예제 #2
0
    // 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);
        }
    }
예제 #3
0
 //This function ensures that the object is not destructed between scenes (so that the logging information can be accessed at any time)
 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();
    }