Ejemplo n.º 1
0
    private void MinigameFinished(IMinigame minigame, bool win)
    {
        print("Destroyed");
        minigame.DestroyMinigame();

        Minigame minigameValues = GetMinigameOfType(minigame.minigame);
        float    sanityAmount;

        if (win)
        {
            sanityAmount = minigameValues.sanityGain;
        }
        else
        {
            sanityAmount = minigameValues.sanityLoss;
        }
        currentInteractable.InMinigame = false;

        Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);

        GameManager.Instance.FreezeGame = false;
        GameManager.Instance.Sanity    += sanityAmount;
        UIEvents.EndRequest(minigame.minigame);
        UIEvents.SanityUpdate(GameManager.Instance.Sanity);
    }
Ejemplo n.º 2
0
 //Updates the UI with the minigame information
 public void UpdateMinigameUI(Minigame minigame)
 {
     nameText.text        = minigame.name;
     descriptionText.text = minigame.description;
     demoAnimator.SetTrigger(minigame.sceneName);
     //demoImage.sprite = minigame.demo;
 }
Ejemplo n.º 3
0
 static void Prefix(Minigame __instance)
 {
     if (__instance is SecurityLogGame)
     {
         UseCameraTime();
     }
 }
Ejemplo n.º 4
0
 void Start()
 {
     //getting all children minigames in list
     GetComponentsInChildren <Minigame>(true, minigames);
     currentMinigame       = minigames[0];
     currentMinigameScreen = minigameScreens[0];
 }
Ejemplo n.º 5
0
    void Start()
    {
        //checks if minigame is already completed
        camPos = minigameCam.gameObject.transform.position;
        Minigame temp = quests.minigames.FirstOrDefault(q => q.name == minigameName);

        if (temp != null)
        {
            if (temp.completed)
            {
                print("already completed");
            }
            else
            {
                quests.minigames.Add(new Minigame()
                {
                    name = minigameName, completed = false
                });
            }
        }


        minigameCam.enabled = false;
        maincam             = GameObject.Find("Main Camera").GetComponent <Camera>();
        Positions();
    }
    public void onMinigameStart(Minigame minigame)
    {
        TimerManager.Instance.StartTimer(minigame.gameTime);
        var waitTime = minigame.gameTime == Minigame.GameTime.Short ? ShortTime : LongTime;

        StartCoroutine(WaitForMinigameEnd(minigame, waitTime));
    }
Ejemplo n.º 7
0
    public void StartGame(Minigame game)
    {
        gameTimer   = 0f;
        gameActive  = true;
        currentGame = game;
        scoreBoard.SetActive(false);
        switch (game)
        {
        case Minigame.Nails:
            nailGame.SetActive(true);
            eggGame.SetActive(false);
            callGame.SetActive(false);
            break;

        case Minigame.Eggs:
            nailGame.SetActive(false);
            eggGame.SetActive(true);
            callGame.SetActive(false);
            break;

        case Minigame.Calls:
            nailGame.SetActive(false);
            eggGame.SetActive(false);
            callGame.SetActive(true);
            break;

        default:
            break;
        }
    }
Ejemplo n.º 8
0
    public void UpdateScoreBoard(Minigame game, int score)
    {
        switch (game)
        {
        case Minigame.Nails:
            if (score > nailsScore)
            {
                nailsScore = score;
            }
            nailsText.text = string.Format("Nails: {0} in 60sec", nailsScore);
            break;

        case Minigame.Eggs:
            if (score > eggsScore)
            {
                eggsScore = score;
            }
            eggsText.text = string.Format("Eggs: {0} in 60sec", eggsScore);
            break;

        case Minigame.Calls:
            if (score > callsScore)
            {
                callsScore = score;
            }
            callsText.text = string.Format("Calls: {0} in 60sec", callsScore);
            break;

        default:
            break;
        }
    }
        private void Start()
        {
            minigameManager = FindObjectOfType <MinigameManager>();
            minigame        = minigameManager.minigame;

            minigame.gameWin = true;
        }
Ejemplo n.º 10
0
    public void RequestMinigame()
    {
        Minigame minigame = RollMinigame();

        var interactables = GetAllAvailableInteractablesForMinigame(minigame.MinigameType);

        // second roll
        if (interactables.Count == 0)
        {
            minigame      = RollMinigame();
            interactables = GetAllAvailableInteractablesForMinigame(minigame.MinigameType);

            if (interactables.Count == 0)
            {
                return;
            }
        }

        int          randomInteractible = Random.Range(0, interactables.Count);
        Interactable interactable       = interactables[randomInteractible];

        interactable.SetInteractable(true);

        print("Dispalying minigame" + minigame.MinigameType);
        UIEvents.DisplayRequest(minigame.MinigameType);
        StartCoroutine(TimeToStartMinigame(interactable, minigame.timeToStart, randomInteractible));
    }
Ejemplo n.º 11
0
 // Start is called before the first frame update
 void Start()
 {
     mini            = GetComponent <Minigame>();
     stickUpDown     = false;
     pickCount       = 0;
     sparkle.enabled = false;
 }
Ejemplo n.º 12
0
 static void Prefix(Minigame __instance)
 {
     if (__instance is VitalsMinigame)
     {
         UseVitalsTime();
     }
 }
Ejemplo n.º 13
0
    public IEnumerator MG1MinigameScoreIncreases()
    {
        yield return(Setup());

        SceneChanger sceneChanger = GameObject.Find("SceneChanger").GetComponent <SceneChanger> ();

        sceneChanger.loadLevel("MiniGame", new Vector2(10000, 10000));
        float time = 0f;

        while (time < 1f)
        {
            yield return(null);

            time += Time.deltaTime;
        }

        GameObject.Find("StartButton").GetComponent <UnityEngine.UI.Button> ().onClick.Invoke();

        GameObject button = null;

        while (button == null)
        {
            yield return(null);

            try{
                button = GameObject.Find("GooseButton(Clone)");
            }catch (NullReferenceException) {
            }
        }
        Minigame m = GameObject.Find("MiniGameCanvas").GetComponent <Minigame> ();

        Assert.Zero(m.score);
        button.GetComponent <UnityEngine.UI.Button> ().onClick.Invoke();
        Assert.AreEqual(1, m.score);
    }
Ejemplo n.º 14
0
 public static void Prefix(Minigame __instance)
 {
     if (__instance is SecurityLogGame)
     {
         cameraTimer = 0f;
     }
 }
Ejemplo n.º 15
0
 public void StartMinigame()
 {
     animatorTransition.SetTrigger("Start");
     animatorTransition.SetInteger("Random", Random.Range(0, 2));
     currentMinigame = Instantiate(minigamesList[0], this.transform);
     currentMinigame.SetEndMinigame(EndMinigame);
 }
Ejemplo n.º 16
0
    // MonoBehaviour Methods

    private void Awake()
    {
        if (minigameMasterList == null)
        {
            LoadMinigameMasterList();
        }
        if (playerSettings == null)
        {
            LoadPlayerSettings();
        }
        if (run == null)
        {
            //Adds ONLY current scene game to list -- for testing
            Minigame m = IsInMinigame();
            if (m != null)
            {
                //creates run with only this game
                CreateNewRun(new MinigameList(m));
            }
        }


        debug_playerSettings     = playerSettings;
        debug_minigameMasterList = minigameMasterList;
    }
Ejemplo n.º 17
0
 public void SetMini(Minigame m)
 {
     minigame        = m;
     minigame.xAxis  = control.xAxis;
     minigame.yAxis  = control.yAxis;
     minigame.button = control.button;
 }
Ejemplo n.º 18
0
    private void Start()
    {
        switch (index)
        {
        case 0:
            minigame = new QTEMinigame();
            break;

        case 1:
            minigame = new GuitarHeroMinigame();
            break;

        case 2:
            minigame = new SpamMinigame();
            break;

        case 3:
            minigame = new YouSpinMeRightRoundMinigame();
            break;

        default:
            Debug.Log("This should not be called");
            minigame = new QTEMinigame();
            break;
        }
    }
Ejemplo n.º 19
0
    private void Start()
    {
        MinigameInput minigameInput;

        //Neutral MinigameInput
        minigameInput = new MinigameInput(0, 0, 0, this);

        //Hard MinigameInput
        //minigameInput = new MinigameInput(1, 1, 1, this);

        //Easy MinigameInput
        //minigameInput = new MinigameInput(-1, -1, -1, this);

        //Spawn Game on this Canvas, its inactive by default to allow setting MinigameInput
        GameObject spawned = GameObject.Instantiate(minigameToSpawn, this.transform);

        game       = spawned.GetComponent <Minigame>();
        game.Input = minigameInput;
        spawned.SetActive(true);

        //Positions of relevant Gameobjects for each Answer
        GameObject[] answerA = GameObject.FindGameObjectsWithTag("AnswerA");
        GameObject[] answerB = GameObject.FindGameObjectsWithTag("AnswerB");
        Invoke("go", 1.0f);
    }
Ejemplo n.º 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetPageRibbon(StandardModuleRibbons.SetupRibbon());
            }

            //MasterPage.RequiredPermission = PERMISSIONID;
            MasterPage.IsSecure  = true;
            MasterPage.PageTitle = string.Format("{0}", "Code Breaker Key Setup");

            if (!IsPostBack)
            {
                if (Request["MGID"] != null)
                {
                    lblMGID.Text = Request["MGID"];
                    lblCBID.Text = Request["CBID"];

                    var o = Minigame.FetchObject(int.Parse(lblMGID.Text));
                    AdminName.Text = o.AdminName;
                }
                else
                {
                    Response.Redirect("~/ControlRoom/");
                }
                rptr.DataSource = GetKeyCharacters();
                rptr.DataBind();
            }
        }
Ejemplo n.º 21
0
        protected void GvRowCommand(object sender, GridViewCommandEventArgs e)
        {
            string editpage = "~/ControlRoom/Modules/Setup/MinigameAddEdit.aspx";

            if (e.CommandName.ToLower() == "addrecord")
            {
                Session["MGID"] = "";
                Response.Redirect(editpage);
            }
            if (e.CommandName.ToLower() == "editrecord")
            {
                int key = Convert.ToInt32(e.CommandArgument);
                var obj = Minigame.FetchObject(key);
                //Response.Redirect(Minigame.GetEditPage(obj.MiniGameType) + "?PK=" + obj.MGID.ToString());
                Session["MGID"] = obj.MGID;
                Response.Redirect(Minigame.GetEditPage(obj.MiniGameType));
            }
            if (e.CommandName.ToLower() == "deleterecord")
            {
                var key = Convert.ToInt32(e.CommandArgument);
                try
                {
                    var obj = new Minigame();
                    if (obj.IsValid(BusinessRulesValidationMode.DELETE))
                    {
                        Minigame.FetchObject(key).Delete();

                        LoadData();
                        var masterPage = (IControlRoomMaster)Master;
                        if (masterPage != null)
                        {
                            masterPage.PageMessage = SRPResources.DeleteOK;
                        }
                    }
                    else
                    {
                        var    masterPage = (IControlRoomMaster)Master;
                        string message    = String.Format(SRPResources.ApplicationError1, "<ul>");
                        foreach (BusinessRulesValidationMessage m in obj.ErrorCodes)
                        {
                            message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage);
                        }
                        message = string.Format("{0}</ul>", message);
                        if (masterPage != null)
                        {
                            masterPage.PageError = message;
                        }
                    }
                }
                catch (Exception ex)
                {
                    var masterPage = (IControlRoomMaster)Master;
                    if (masterPage != null)
                    {
                        masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message);
                    }
                }
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Subscribes a Minigame.Controller to this controller event handler.
        /// </summary>
        /// <param name="controller">Minigame.Controller which is subscribing</param>
        public void Subscribe(Minigame.Controller controller)
        {
            // Create event handler if not created yet
            if (m_eventHandler == null)
                m_eventHandler = new Utils.Observable();

            m_eventHandler.Subscribe(controller);
        }
 public void OnMinigameStart(Minigame game)
 {
     if (player == null)
     {
         return;
     }
     player.playerInteraction.OnMinigameStart(game);
 }
Ejemplo n.º 24
0
 // Start is called before the first frame update
 void Start()
 {
     mini = GetComponent <Minigame>();
     swordGuy.transform.localPosition = new Vector3(1.25f, 0.25f, 0.0f);
     _guy        = swordGuy.GetComponent <SpriteRenderer>();
     _enemy      = Enemy.GetComponent <SpriteRenderer>();
     swingTiming = Random.Range(2f, 3f);
 }
Ejemplo n.º 25
0
    public void InsertGame(Minigame game)
    {
        _command.Parameters.Clear();
        _command.CommandText = "INSERT INTO Games(name) VALUES (@name);";
        _AddCommandParameter("name", game.name);

        _ExecuteCommand();
    }
 public void OnMinigameAborted(Minigame game)
 {
     if (player == null)
     {
         return;
     }
     player.playerInteraction.OnMinigameAborted(game);
 }
Ejemplo n.º 27
0
 public void ResetPizza()
 {
     m_pizza.Reset();
     if (Order.MysteryPizza)
     {
         Minigame.PlaySFX("mg_pt_sfx_mystery_pizza_start");
     }
 }
Ejemplo n.º 28
0
        public async Task CreateStatRecord(Player player)
        {
            List <Skill>    skills    = new List <Skill>();
            List <Minigame> minigames = new List <Minigame>();
            var             apiData   = await OfficialApiCall(_address + player.Username);

            if (apiData == null)
            {
                return;
            }
            string[] lines = apiData.Split('\n');

            // adding a StatRecord object
            StatRecord newStatRecord = new StatRecord()
            {
                DateCreated = DateTime.Now,
                UserId      = player.Id,
                Player      = player
            };

            // looping through the skills and adding them
            for (var i = 0; i < _totalSkills; i++)
            {
                String[] stat  = lines[i].Split(',');
                Skill    skill = new Skill()
                {
                    SkillId      = i,
                    Xp           = Int64.Parse(stat[2]),
                    Level        = Int32.Parse(stat[1]),
                    Rank         = Int32.Parse(stat[0]),
                    StatRecordId = newStatRecord.Id
                };
                skill.Xp   = skill.Xp < 0 ? 0 : skill.Xp;
                skill.Rank = skill.Rank < 0 ? 0 : skill.Rank;
                skills.Add(skill);
            }

            // looping through the minigames and adding them
            for (var i = _totalSkills; i < lines.Length - 1; i++)
            {
                String[] stat     = lines[i].Split(',');
                Minigame minigame = new Minigame()
                {
                    MinigameId   = i,
                    Score        = Int32.Parse(stat[1]),
                    Rank         = Int32.Parse(stat[0]),
                    StatRecordId = newStatRecord.Id
                };
                minigame.Score = minigame.Score < 0 ? 0 : minigame.Score;
                minigame.Rank  = minigame.Rank < 0 ? 0 : minigame.Rank;
                minigames.Add(minigame);
            }

            newStatRecord.Skills    = skills;
            newStatRecord.Minigames = minigames;
            player.StatRecords.Add(newStatRecord);
        }
Ejemplo n.º 29
0
 public MainForm(Minigame game)
 {
     Misc.closeGameWindow = () => { level.initGame(minigamePanel, minigameClockT); };
     level = game;
     InitializeComponent();
     minigameClockT.Interval = level.gameClock;
     Text = level.name;
     Misc.closeGameWindow.Invoke();
 }
Ejemplo n.º 30
0
    public void LoadGame()
    {
        int nextGame = rnd.Next(0, minigames.Count);

        currentMinigameScreen = minigameScreens[nextGame];
        currentMinigameScreen.SetActive(true);
        currentMinigame = minigames[nextGame];
        currentMinigame.StartGame();
    }
Ejemplo n.º 31
0
    public MinigameButton(GameObject toggle, GameObject selectedButton, Minigame minigame)
    {
        _toggle         = toggle.GetComponent <Toggle>();
        _selectedButton = selectedButton.GetComponent <Button>();

        _minigame = minigame;

        SetProperties();
    }
Ejemplo n.º 32
0
    private GameObject[] pool_of_things = null; // misc.get_children_of(GameObject.Find("ThingsPool"));

    #endregion Fields

    #region Constructors

    //public Vector3 ScreenspacePointToGamePlane(Vector3 screenspace_position)
    //{
    //    return misc.ScreenspacePointToPlane(gamePlane, screenspace_position);
    //}
    // Things for the helper's internals
    public MinigameHelper( Minigame minigame, Interface inface, GameObject[] pool_of_things )
    {
        this.pool_of_things = pool_of_things;

        this.minigame = minigame;
        minigame.helper = this;
        minigame.init_text();
        name = minigame.name;
        instructions = minigame.instructions;

        this.inface = inface;
        inface.init();

        //gamePlane = new Plane( new Vector3( 0,0,1 ), 0.3f );

        // add more event monitoring
        onButton += () =>
        {
            Ray ray = Camera.main.ScreenPointToRay(inface.get_ScreenspacePosition());
            selected = misc.Raycast_Select_Object(ray);
            //Debug.Log("Raycast: " + selected);
            if (selected != null)
            {
                onSelect(selected);
            }
        };

        onMove += () =>
        {
            //Debug.Log("Drag? " + action_held + " : " + selected);
            if (selected != null && action_held)
            {
                onDrag(selected);
            }
        };
    }
Ejemplo n.º 33
0
    void Start()
    {
        Instance = this;

        //changing these to the background sprite to attempt to access their color directly, if it doesn't work,
        //change it back to "MoveRightHandButton" etc.
        userButtons [(int)eType.RIGHT] = new PlayerSprite ("MoveRightHandButton");
        userButtons [(int)eType.LEFT] = new PlayerSprite ("MoveLeftHandButton");
        userButtons [(int)eType.CLAP] = new PlayerSprite ("MoveClapHandButton");
        UpdatePlayerTextures();

        tutorialHand = GameObject.Find("TutorialHand");
        tutorialHand.SetActive(false);

        Sherlock.Instance.SetBubblePosition (Sherlock.side.DOWN);

        // Find assocciated minigame
        minigame = GetComponent<Minigame> ();

        Sherlock.Instance.HideDialogue();

        if(!minigame.isStandalone()) //if the minigame is part of the story, not free play mode
        {
            Destroy(tutorialOptions);
            showTutorial = true;

            // Show the instructions of the minigame
            if (minigame != null && minigame.StartConversation () == false) {
                Debug.Log (minigame.conversationTree.root);
            }

            Invoke("continueDialogue", minigame.GetCurrentDialogueDuration());
            leftLabelOffset = instructionLabelOffset;
            rightLabelOffset = instructionLabelOffset;
            rightLabelOffset.x = -rightLabelOffset.x;

            SetHandColliders(false);
        }
        //noTutorial();
    }
Ejemplo n.º 34
0
    public void end()
    {
        OnUpdate.unregister(this.update);

        // cleanup
        this.minigame.destroy();
        ScreenspaceCursor.hide();
        //current_interface.disable();

        foreach ( GameObject obj in created )
        {
            obj.SetActive(false);
            GameObject.Destroy(obj);
        }

        inface.off();

        // show success / failure animation
        // TODO:
        if ( success)    Debug.Log("SUCCESS");
        else             Debug.Log("FAILURE");

        //kill circular reference
        this.minigame = null;

        // cue next scene
        has_ended = true;
    }
Ejemplo n.º 35
0
    // Use this for initialization
    void Start()
    {
        //phase = 0;
        //Debug.Log("Phase: " + phase);
        Instance = this;
        //notepad.SetActive(false);
        Sherlock.Instance.SetBubblePosition (Sherlock.side.DOWN);
        //set cont to true if you want to use the WaitforInput coroutine
        cont = true;
        turnOffPanels = false;
        sherTapObj = 0;
        newPanels = false;
        correctCountRef = 0;
        turnOnBlameRef = false;
        hitSlot = false;
        finishedSequence = false;
        column1 = false;
        column2 = false;
        column3 = false;
        column4 = false;
        column5 = false;
        reset = false;
        colorsWhiteRef = false;
        lightsOn = false;
        jRef = 0;
        numSlotsCor = 0;
        playSeqRef = 0;
        redDotted1.SetActive(false);
        redDotted2.SetActive(false);
        redDotted3.SetActive(false);
        redDotted4.SetActive(false);
        blameSequence.SetActive(false);
        highlights.SetActive(false);
        /*myLevels = new GameObject[numLevels];
        //find first level, or MaxLevel0
        //myLevels[0] = GameObject.Find("MaxLevel0");
        //fill up myLevels with remaining
        //int i = 1;
        for (int i = 0 ; i < numLevels ; i++)//(GameObject.Find("MaxLevel" + i.ToString()) !=null)
        {
            myLevels[i] = GameObject.Find("MaxLevel" + i.ToString());
            myLevels[i].SetActive(false);
        }*/

        // Find assocciated minigame
        minigame = GetComponent<Minigame>();

        // Show the instructions of the minigame
        if (minigame != null && minigame.StartConversation() == false)
        {
            Debug.Log("S: Let's help Max make new choices based on what he already likes. Max will give you a description for each category, you choose something similar.");
        }
        //StartCoroutine(WaitForInput("nextLevel"));

        //turnOffPanels = true;
        playSeqRef = options.GetComponent<BlakeTurnOnOptions>().playSeq;

        nextLevel();
    }
Ejemplo n.º 36
0
    // Use this for initialization
    void Start()
    {
        // Find assocciated minigame
        minigame = GetComponent<Minigame>();

        Sherlock.Instance.SetBubblePosition (Sherlock.side.DOWN);

        IncreaseMinigameSpeed(verticalSpeedIncrease);

        //gameState = GameState.MINIGAME;
        //gameState = GameState.STORY;

        //minigame.difficulty = MinigameDifficulty.Difficulty.MEDIUM;

        //EndMinigame();
        //if (true)

        if(GameObject.FindGameObjectWithTag("Player") != null){
            gameState = GameState.STORY;
        }
        else{
            gameState = GameState.MINIGAME;
        }
        //gameState = GameState.STORY;

        barGlow.gameObject.SetActive(false);
        if(gameState == GameState.STORY)
        {
            Destroy(tutorialOptions);
            scoreLabel.gameObject.SetActive(false);
            scoreTitleLabel.gameObject.SetActive(false);
            healthBar.transform.parent.gameObject.SetActive(false);

            if (gameState == GameState.STORY && ShowDialogue(DialogueType.BEGIN) == true)
            {
                Debug.Log("Starting!!");
            }
        //			if (gameState == GameState.STORY && ShowDialogue(DialogueType.NEXTROUND) == true)
        //			{
        //				Debug.Log("Starting!!");
        //			}
        //
        }

        else
        {
            treasureBar.transform.parent.gameObject.SetActive(false);
            enemyBar.transform.parent.gameObject.SetActive(false);
            timeBar.transform.parent.gameObject.SetActive(false);
            updateScore(0);

            if(minigame.difficulty == MinigameDifficulty.Difficulty.EASY)
                round = 1;

            else if(minigame.difficulty == MinigameDifficulty.Difficulty.MEDIUM){
                round = 2;
            }

            else if(minigame.difficulty == MinigameDifficulty.Difficulty.HARD){
                IncreaseMinigameSpeed(0.2f);
                round = 3;
            }

        }
    }
Ejemplo n.º 37
0
    /// <summary>
    /// Handle Event: BeginMinigame
    /// </summary>
    /// <param name='minigame'>
    /// Minigame
    /// </param>
    public void BeginMinigame(Minigame minigame)
    {
        // Set mnigame owner to interacting NPC
        minigame.owner = interactingNPC;

        // Set scene minigame to give minigame
        GameManager.Instance.minigame = minigame;

        // Set interaction state to in event
        interactionState = InteractionState.IN_EVENT;
    }
Ejemplo n.º 38
0
    // Use this for initialization
    void Start()
    {
        // Find assocciated minigame
        minigame = GetComponent<Minigame>();

        tutorialHand = GameObject.Find ("TutorialHand");
        tutorialHand.SetActive(false);

        currLevel = 0;
        foreach(DifficultySession ds in difficultySessions) {
            if(ds.difficulty == minigame.difficulty) {
                currentDifficultySession = ds;
                break;
            }
        }

        setupGame();

        if(!minigame.isStandalone()) //if the minigame is part of the story, not free play mode
        {
            Destroy(tutorialOptions);
            if(!showTutorial)
            {
                setupLevel();
                disableAllKeys();
            }

            // Show the instructions of the minigame
            if (minigame != null && minigame.StartConversation() == false)
            {
                Debug.Log("S: Let's get this lock open!");
            }

            Invoke("continueDialogue", minigame.GetCurrentDialogueDuration());
        }

        if (minigame.minigameEndEvent != null)
            minigame.minigameEndEvent.location = null;
    }
Ejemplo n.º 39
0
    // Use this for initialization
    void Start()
    {
        Random.seed = (int) (System.DateTime.UtcNow.Ticks % int.MaxValue);

        // Find assocciated minigame
        minigame = GetComponent<Minigame>();
        Sherlock.Instance.SetBubblePosition(Sherlock.side.DOWN);

        interestOptionsRoot.SetActive(false);
        hiddenObjectsRoot.SetActive(false);

        tutorialHand = GameObject.Find ("TutorialHand").GetComponent<TutorialHand>();

        currentLevel = -1;
        ShuffleCharacters();
        ResetDisplayObjects();

        Sherlock.Instance.HideDialogue();

        if(!minigame.isStandalone()) //if the minigame is part of the story, not free play mode
        {
            Destroy(tutorialOptions);
            if(showTutorial)
            {
                // Show the instructions of the minigame
                if (minigame != null && minigame.StartConversation() == false)
                {
                    Debug.Log("To learn other peoples’ interests, use your eyes to find clues about them.");
                }
                StartCoroutine("startTutorial");
            }
            else
            {
                // Show the instructions of the minigame
                if (minigame != null && minigame.StartConversation() == false)
                {
                    Debug.Log("To learn other peoples’ interests, use your eyes to find clues about them.");
                }
                Invoke ("InitializeFirstLevel", minigame.GetCurrentDialogueDuration());
            }
        }
    }
Ejemplo n.º 40
0
    // Use this for initialization
    void Start()
    {
        // Find assocciated minigame
        minigame = GetComponent<Minigame>();
        MinigameDifficulty.Difficulty difficulty = minigame.difficulty;

        // Initialize levels array
        myLevels = new GameObject[numLevels];

        // Easy or medium assets
        if(minigame.difficulty != MinigameDifficulty.Difficulty.HARD) {

            foodsAtlas = (UIAtlas) Resources.Load ("NPCs/Amy/AmyLargeFoodBuffetAtlas", typeof(UIAtlas));

            // Gets all large foods
            foreach(string s in foodsAtlas.GetListOfSprites()) {
                if(s.Contains("dess")) {
                    dessertItems.Add (s);
                } else if(s.Contains("app")) {
                    appetizerItems.Add (s);
                } else if(s.Contains("main")) {
                    mainItems.Add (s);
                }
            }

            // Randomizes the possible appetizer foods
            for(int appRandomizer = 0; appRandomizer < appetizerItems.Count; appRandomizer++) {
                int randomindex = Random.Range(appRandomizer, appetizerItems.Count - 1);
                string swap = (string)appetizerItems[randomindex];
                appetizerItems[randomindex] = appetizerItems[appRandomizer];
                appetizerItems[appRandomizer] = swap;
            }

            // Randomizes the possible main foods
            for(int mainRandomizer = 0; mainRandomizer < mainItems.Count; mainRandomizer++) {
                int randomindex = Random.Range(mainRandomizer, mainItems.Count - 1);
                string swap = (string)mainItems[randomindex];
                mainItems[randomindex] = mainItems[mainRandomizer];
                mainItems[mainRandomizer] = swap;
            }

            // Randomizes the possible dessert foods
            for(int dessertRandomizer = 0; dessertRandomizer < dessertItems.Count; dessertRandomizer++) {
                int randomindex = Random.Range(dessertRandomizer, dessertItems.Count - 1);
                string swap = (string)dessertItems[randomindex];
                dessertItems[randomindex] = dessertItems[dessertRandomizer];
                dessertItems[dessertRandomizer] = swap;
            }
        }

        // Hard assets
        if(minigame.difficulty == MinigameDifficulty.Difficulty.HARD) {

            foodsAtlas = (UIAtlas) Resources.Load ("NPCs/Amy/AmySmallFoodBuffetAtlas", typeof(UIAtlas));

            // Gets all large foods
            foreach(string s in foodsAtlas.GetListOfSprites()) {
                if(s.Contains("dess")) {
                    dessertItems.Add (s);
                } else if(s.Contains("app")) {
                    appetizerItems.Add (s);
                } else if(s.Contains("main")) {
                    mainItems.Add (s);
                }
            }

            // Randomizes the possible appetizer foods
            for(int appRandomizer = 0; appRandomizer < appetizerItems.Count; appRandomizer++) {
                int randomindex = Random.Range(appRandomizer, appetizerItems.Count - 1);
                string swap = (string)appetizerItems[randomindex];
                appetizerItems[randomindex] = appetizerItems[appRandomizer];
                appetizerItems[appRandomizer] = swap;
            }

            // Randomizes the possible main foods
            for(int mainRandomizer = 0; mainRandomizer < mainItems.Count; mainRandomizer++) {
                int randomindex = Random.Range(mainRandomizer, mainItems.Count - 1);
                string swap = (string)mainItems[randomindex];
                mainItems[randomindex] = mainItems[mainRandomizer];
                mainItems[mainRandomizer] = swap;
            }

            // Randomizes the possible dessert foods
            for(int dessertRandomizer = 0; dessertRandomizer < dessertItems.Count; dessertRandomizer++) {
                int randomindex = Random.Range(dessertRandomizer, dessertItems.Count - 1);
                string swap = (string)dessertItems[randomindex];
                dessertItems[randomindex] = dessertItems[dessertRandomizer];
                dessertItems[dessertRandomizer] = swap;
            }
        }

        // Get all the foods in the target trays
        ArrayList targetFoodsSmall = new ArrayList();
        foreach(Transform targetFood in smallTargetTray.transform) {
            if(!targetFood.gameObject.name.Contains("Tray")) {
                targetFoodsSmall.Add (targetFood.gameObject);
            }
        }
        ArrayList targetFoodsLarge = new ArrayList();
        foreach(Transform targetFood in largeTargetTray.transform) {
            if(!targetFood.gameObject.name.Contains("Tray")) {
                targetFoodsLarge.Add (targetFood.gameObject);
            }
        }

        // Remove two plates from the target trays
        for(int randomInt = 0; randomInt < 2; randomInt++) {
            int randomIndex = Random.Range(0, targetFoodsSmall.Count - 1);
            GameObject targetFoodToRemove = ((GameObject)targetFoodsSmall[randomIndex]).gameObject;
            targetFoodToRemove.SetActive(false);
            targetFoodsSmall.Remove(targetFoodToRemove);
            GameObject targetFoodToRemoveLarge = largeTargetTray.transform.FindChild(targetFoodToRemove.name).gameObject;
            targetFoodToRemoveLarge.SetActive(false);
            targetFoodsLarge.Remove(targetFoodToRemoveLarge);
        }

        // Get dropspots from player tray
        GameObject[] dropspots = new GameObject[5];
        for(int dropspotsCounterOne = 0; dropspotsCounterOne < 5; dropspotsCounterOne++)
            dropspots[dropspotsCounterOne] = playerTray.transform.FindChild("Slot" + (dropspotsCounterOne + 1).ToString()).gameObject;

        // Get all levels in the scene
        int i = 0;
        moveDistace.x = buffetTexture.transform.localScale.x;
        while(i < myLevels.Length)
        {
            Transform t = buffet.transform.FindChild("BuffetLevel" + i.ToString());
            if (t != null)
            {
                myLevels[i] = t.gameObject;

                // Get all food items in the current level
                ArrayList foods = new ArrayList();

                // Easy difficulty, 4 items
                if(difficulty == MinigameDifficulty.Difficulty.EASY) {
                    for(int easyCounter = 0; easyCounter < 4; easyCounter++) {
                        GameObject newFood = (GameObject) Instantiate(buffetItem);
                        newFood.transform.parent = myLevels[i].transform;
                        newFood.transform.localPosition = new Vector3(-250 + easyCounter * 90, 290 - easyCounter % 2 * 200, 10);
                        newFood.transform.localScale = new Vector3(2, 2, 2);
                        newFood.transform.FindChild("Buffet_ItemHard1").gameObject.SetActive(false);
                        newFood.transform.FindChild("Buffet_ItemHard2").gameObject.SetActive(false);
                        GameObject newFoodItem = newFood.transform.FindChild("Buffet_ItemEasy").gameObject;
                        newFoodItem.GetComponent<UISprite>().atlas = foodsAtlas;
                        for(int dropspotsCounter = 0; dropspotsCounter < 5; dropspotsCounter++)
                            newFood.GetComponent<DraggableObjectBuffet>().dropspots[dropspotsCounter] = dropspots[dropspotsCounter];
                        switch(i) {
                        case 0:
                            newFoodItem.GetComponent<UISprite>().spriteName = (string)appetizerItems[easyCounter];
                            break;
                        case 1:
                            newFoodItem.GetComponent<UISprite>().spriteName = (string)mainItems[easyCounter];
                            break;
                        case 2:
                            newFoodItem.GetComponent<UISprite>().spriteName = (string)dessertItems[easyCounter];
                            break;
                        default:
                            newFood.GetComponent<UISprite>().spriteName = (string)appetizerItems[easyCounter];
                            break;
                        }
                        foods.Add(newFood);
                    }
                }

                // Medium difficulty, 8 items
                if(difficulty == MinigameDifficulty.Difficulty.MEDIUM) {
                    for(int mediumCounter = 0; mediumCounter < 8; mediumCounter++) {
                        GameObject newFood = (GameObject) Instantiate(buffetItem);
                        newFood.transform.parent = myLevels[i].transform;
                        newFood.transform.localPosition = new Vector3(-370 + mediumCounter * 77 - (mediumCounter % 2)*30, 260 - mediumCounter % 2 * 180, 10);
                        newFood.transform.localScale = new Vector3(2, 2, 2);
                        newFood.transform.FindChild("Buffet_ItemHard1").gameObject.SetActive(false);
                        newFood.transform.FindChild("Buffet_ItemHard2").gameObject.SetActive(false);
                        GameObject newFoodItem = newFood.transform.FindChild("Buffet_ItemEasy").gameObject;
                        newFoodItem.GetComponent<UISprite>().atlas = foodsAtlas;
                        for(int dropspotsCounter = 0; dropspotsCounter < 5; dropspotsCounter++)
                            newFood.GetComponent<DraggableObjectBuffet>().dropspots[dropspotsCounter] = dropspots[dropspotsCounter];
                        switch(i) {
                        case 0:
                            newFoodItem.GetComponent<UISprite>().spriteName = (string)appetizerItems[mediumCounter];
                            break;
                        case 1:
                            newFoodItem.GetComponent<UISprite>().spriteName = (string)mainItems[mediumCounter];
                            break;
                        case 2:
                            newFoodItem.GetComponent<UISprite>().spriteName = (string)dessertItems[mediumCounter];
                            break;
                        default:
                            newFood.GetComponent<UISprite>().spriteName = (string)appetizerItems[mediumCounter];
                            break;
                        }
                        foods.Add(newFood);
                    }
                }

                // Hard difficulty, 8 items split
                if(difficulty == MinigameDifficulty.Difficulty.HARD) {
                    for(int hardCounter = 0; hardCounter < 8; hardCounter++) {
                        GameObject newFood = (GameObject) Instantiate(buffetItem);
                        newFood.transform.parent = myLevels[i].transform;
                        newFood.transform.localPosition = new Vector3(-370 + hardCounter * 77 - (hardCounter % 2)*30, 260 - hardCounter % 2 * 180, 10);
                        newFood.transform.localScale = new Vector3(2, 2, 2);
                        newFood.transform.localEulerAngles = new Vector3(0, 0, 30);
                        newFood.transform.FindChild("Buffet_ItemEasy").gameObject.SetActive(false);
                        GameObject newFoodItem1 = newFood.transform.FindChild("Buffet_ItemHard1").gameObject;
                        newFoodItem1.GetComponent<UISprite>().atlas = foodsAtlas;
                        GameObject newFoodItem2 = newFood.transform.FindChild("Buffet_ItemHard2").gameObject;
                        newFoodItem2.GetComponent<UISprite>().atlas = foodsAtlas;
                        for(int dropspotsCounter = 0; dropspotsCounter < 5; dropspotsCounter++)
                            newFood.GetComponent<DraggableObjectBuffet>().dropspots[dropspotsCounter] = dropspots[dropspotsCounter];
                        int nextHardCounter = hardCounter + 1;
                        if(nextHardCounter >= 8)
                            nextHardCounter = 0;
                        switch(i) {
                        case 0:
                            newFoodItem1.GetComponent<UISprite>().spriteName = (string)appetizerItems[hardCounter];
                            newFoodItem2.GetComponent<UISprite>().spriteName = (string)appetizerItems[nextHardCounter];
                            break;
                        case 1:
                            newFoodItem1.GetComponent<UISprite>().spriteName = (string)mainItems[hardCounter];
                            newFoodItem2.GetComponent<UISprite>().spriteName = (string)mainItems[nextHardCounter];
                            break;
                        case 2:
                            newFoodItem1.GetComponent<UISprite>().spriteName = (string)dessertItems[hardCounter];
                            newFoodItem2.GetComponent<UISprite>().spriteName = (string)dessertItems[nextHardCounter];
                            break;
                        default:
                            newFood.GetComponent<UISprite>().spriteName = (string)appetizerItems[hardCounter];
                            newFoodItem2.GetComponent<UISprite>().spriteName = (string)appetizerItems[nextHardCounter];
                            break;
                        }
                        foods.Add(newFood);
                    }
                }

                // Randomize the order of items in the buffet
                for(int foodsCounter = 0; foodsCounter < foods.Count; foodsCounter++) {
                    int randomindex = Random.Range(foodsCounter, foods.Count - 1);
                    // Swap positions
                    float x = ((GameObject)foods[randomindex]).transform.position.x;
                    float y = ((GameObject)foods[randomindex]).transform.position.y;
                    ((GameObject)foods[randomindex]).transform.position = new Vector3(
                        ((GameObject)foods[foodsCounter]).transform.position.x,
                        ((GameObject)foods[foodsCounter]).transform.position.y,
                        ((GameObject)foods[foodsCounter]).transform.position.z);
                    ((GameObject)foods[foodsCounter]).transform.position = new Vector3(x, y, ((GameObject)foods[foodsCounter]).transform.position.z);
                }

                // Make one item the target food
                GameObject correctFood = (GameObject)foods[Random.Range(0, foods.Count - 1)];
                GameObject correctFoodEasy = correctFood.transform.FindChild("Buffet_ItemEasy").gameObject;
                GameObject correctFoodHard1 = correctFood.transform.FindChild("Buffet_ItemHard1").gameObject;
                GameObject correctFoodHard2 = correctFood.transform.FindChild("Buffet_ItemHard2").gameObject;
                // Update the small and large food tray's plate for easy and medium
                if(difficulty != MinigameDifficulty.Difficulty.HARD) {
                    ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemHard1").gameObject.SetActive(false);
                    ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemHard2").gameObject.SetActive(false);
                    ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemEasy").gameObject.GetComponent<UISprite>().atlas = foodsAtlas;
                    ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemEasy").gameObject.GetComponent<UISprite>().spriteName =
                        correctFoodEasy.GetComponent<UISprite>().spriteName;
                    // Find and update the large food tray's plate
                    foreach(GameObject g in targetFoodsLarge) {
                        if(g.name == ((GameObject)targetFoodsSmall[i]).gameObject.name) {
                            g.transform.FindChild("Buffet_ItemHard1").gameObject.SetActive(false);
                            g.transform.FindChild("Buffet_ItemHard2").gameObject.SetActive(false);
                            g.transform.FindChild("Buffet_ItemEasy").gameObject.GetComponent<UISprite>().atlas = foodsAtlas;
                            g.transform.FindChild("Buffet_ItemEasy").GetComponent<UISprite>().spriteName = correctFoodEasy.GetComponent<UISprite>().spriteName;
                            break;
                        }
                    }
                } else if(difficulty == MinigameDifficulty.Difficulty.HARD) {
                    ((GameObject)targetFoodsSmall[i]).transform.localEulerAngles = new Vector3(0, 0, 30);
                    ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemEasy").gameObject.SetActive(false);
                    ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemHard1").gameObject.GetComponent<UISprite>().atlas = foodsAtlas;
                    ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemHard1").gameObject.GetComponent<UISprite>().spriteName =
                        correctFoodHard1.GetComponent<UISprite>().spriteName;
                    ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemHard2").gameObject.GetComponent<UISprite>().atlas = foodsAtlas;
                    ((GameObject)targetFoodsSmall[i]).transform.FindChild("Buffet_ItemHard2").gameObject.GetComponent<UISprite>().spriteName =
                        correctFoodHard2.GetComponent<UISprite>().spriteName;
                    // Find and update the large food tray's plate
                    foreach(GameObject g in targetFoodsLarge) {
                        if(g.name == ((GameObject)targetFoodsSmall[i]).gameObject.name) {
                            g.transform.localEulerAngles = new Vector3(0, 0, 30);
                            g.transform.FindChild("Buffet_ItemEasy").gameObject.SetActive(false);
                            g.transform.FindChild("Buffet_ItemHard1").GetComponent<UISprite>().atlas = foodsAtlas;
                            g.transform.FindChild("Buffet_ItemHard1").GetComponent<UISprite>().spriteName = correctFoodHard1.GetComponent<UISprite>().spriteName;
                            g.transform.FindChild("Buffet_ItemHard2").GetComponent<UISprite>().atlas = foodsAtlas;
                            g.transform.FindChild("Buffet_ItemHard2").GetComponent<UISprite>().spriteName = correctFoodHard2.GetComponent<UISprite>().spriteName;
                            break;
                        }
                    }
                }
                correctFood.GetComponent<DraggableObjectBuffet>().isSolution = true;
                correctFood.GetComponent<DraggableObjectBuffet>().correctSlot = ((GameObject)targetFoodsSmall[i]).name.Replace("Spot", "");

                myLevels[i].transform.localPosition = moveDistace * i;
            }
            else
                break;

            i++;
        }

        // Find all game objects related the minigame
        largeSample = GameObject.Find("SampleTrayLarge");
        smallSample = GameObject.Find("SampleTraySmall");
        smallSample.SetActive(false);
        smallSampleBubble = GameObject.Find("SampleTrayBubble");
        smallSampleBubble.SetActive(false);
        myTray = GameObject.Find ("PlayerTray");
        myTray.SetActive(false);
        endGame = GameObject.Find ("EndBackground");
        endGame.SetActive(false);
        buffet.SetActive(false);
        tutorialHand = GameObject.Find("TutorialHand");
        tutorialHand.SetActive(false);
        tutorialBuffet = GameObject.Find ("TutorialBuffet");
        tutorialObject = GameObject.Find ("TutorialObject");
        tutorialBuffet.SetActive(false);
        tutorialObject.SetActive(false);

        if(!minigame.isStandalone()) //if the minigame is part of the story, not free play mode
        {
            Destroy(tutorialOptions);
            if(showTutorial)
            {
                largeSample.SetActive(false);
                myTray.SetActive(true);
                tutorialBuffet.SetActive(true);
                StartCoroutine("startTutorial");
            }
            else
            {
                // Show the instructions of the minigame
                if (minigame != null && minigame.StartConversation() == false)
                {
                    Debug.Log("S: This is Amy's original order. She had a garden salad, burger and strawberries. We must remake Amy's lunch exactly as it appears, so choose the RIGHT item, and place it in the RIGHT location.");
                }

                Invoke ("LayBuffet", minigame.GetCurrentDialogueDuration());
            }
        }
    }
Ejemplo n.º 41
0
    // Use this for initialization
    void Start()
    {
        phase = 0;
        //Debug.Log("Phase: " + phase);

        notepad.SetActive(false);
        cont = true;

        myLevels = new GameObject[numLevels];
        myAnswers = new GameObject[numLevels];
        //find first level, or MaxLevel0
        //myLevels[0] = GameObject.Find("MaxLevel0");
        //fill up myLevels with remaining
        //int i = 1;

        for (int i = 0 ; i < numLevels ; i++)//(GameObject.Find("MaxLevel" + i.ToString()) !=null)
        {
            myLevels[i] = GameObject.Find("MaxLevel" + i.ToString());
            foreach(Transform child in myLevels[i].transform)
            {
                child.gameObject.SetActive(false);
            }
            myAnswers[i] = GameObject.Find("Answer" + i.ToString());

            myAnswers[i].SetActive(false);

        }

        for(int i = 0; i<3; i++)
        {
            crosses[i].SetActive(false);
        }

        // Find assocciated minigame
        minigame = GetComponent<Minigame>();

        tutorialHand = GameObject.Find ("TutorialHand");
        tutorialHand.SetActive(false);

        tutorialObject = GameObject.Find("TutorialObject");
        tutorialObject.SetActive(false);

        notepad.SetActive(true);
        checkmark.SetActive(false);
        phase = 1;
        currLevel = 0;

        PlayAnimation (NPCAnimations.AnimationIndex.NEUTRAL);

        if(!minigame.isStandalone()) //if the minigame is part of the story, not free play mode
        {
            Destroy(tutorialOptions);
            // Show the instructions of the minigame
            if (minigame != null && minigame.StartConversation() == false)
            {
                Debug.Log("S: Let's help Max make new choices based on what he already likes. Max will give you a description for each category, you choose something similar.");
            }

            Invoke("continueDialogue", minigame.GetCurrentDialogueDuration());

            //StartCoroutine(WaitForInput("startGame"));
            //Invoke ("startGame", minigame.conversationTree.root.GetCommulativeDuration() + 1.5f);
        }
    }
Ejemplo n.º 42
0
    // Use this for initialization
    void Start()
    {
        answersList = new List<string>();
        topicSelectorList = new List <int>();
        Sherlock.Instance.SetBubblePosition (Sherlock.side.DOWN);

        tutorialHand.SetActive(false);

        // Find assocciated minigame
        minigame = GetComponent<Minigame>();

        //minigame.difficulty = MinigameDifficulty.Difficulty.EASY;

        switch (minigame.difficulty)
        {
            //total = 4
        case MinigameDifficulty.Difficulty.EASY:
            correctTopics = 1;
            maxNumberIncorrectTopics = 3;
            break;

            //total = 6
        case MinigameDifficulty.Difficulty.MEDIUM:
            correctTopics = 2;
            maxNumberIncorrectTopics = 4;
            break;

            //total = 8
        case MinigameDifficulty.Difficulty.HARD:
            correctTopics = 3;
            maxNumberIncorrectTopics = 5;
            break;
        }

        completeList = new List<List<Texture>>();
        completeList.Add(foodTextureList);
        completeList.Add(feetTextureList);
        completeList.Add(readTextureList);
        completeList.Add(sportsTextureList);
        completeList.Add(vehiclesTextureList);
        completeList.Add(weatherTextureList);

        for(int i = 0; i < 6; i++)
            topicSelectorList.Add(i);

        //SelectTopicsOfConversation();
        int counter = 0;
        foreach(UITexture friend in friends)
        {
            setFriendAnimation(NPCAnimations.AnimationIndex.IDLE,friendsAnims[counter]);
            friend.transform.parent.gameObject.SetActive(false);
            counter++;
        }

        setFriendAnimation(NPCAnimations.AnimationIndex.IDLE, gabyAnim);

        wheel.transform.parent.FindChild("ThoughtBubble").gameObject.SetActive(false);

        Sherlock.Instance.HideDialogue();

        if(!minigame.isStandalone()) //if the minigame is part of the story, not free play mode
        {
            Destroy(tutorialOptions);

            showTutorial = !ApplicationState.Instance.presentationBuild;
            if (ShowDialogue(DialogueType.START) == false)
            {
                Debug.Log("Starting!!");
            }
        }
    }
Ejemplo n.º 43
0
    // Use this for initialization
    void Start()
    {
        wrongTries = 0;
        Instance = this;

        Sherlock.Instance.SetBubblePosition (Sherlock.side.DOWN);

        correctSlotRef = -1;

        phase = 0;

        cont = false;
        puzzleComplete = false;
        hintGiven = false;
        hintAsked = false;

        //shuffle the puzzles
        System.Random rng = new System.Random();
        int n = myPuzzles.Length;
        while (n > 1) {
            n--;
            int k = rng.Next(n + 1);
            GameObject value = myPuzzles[k];
            PuzzleImageType sol = mySolutions[k];
            myPuzzles[k] = myPuzzles[n];
            mySolutions[k] = mySolutions[n];
            myPuzzles[n] = value;
            mySolutions[n]  = sol;
        }
        mySolutions[0].SetActive(false);

        // Find assocciated minigame
        minigame = GetComponent<Minigame>();

        switch (minigame.difficulty)
        {
        case MinigameDifficulty.Difficulty.EASY:
            myPuzzles[0].GetComponent<UITexture>().mainTexture = easyOutline;
            myPuzzles[0].GetComponent<PuzzlePieceTextureMod>().puzzleOutline = easyColored;
            totalPieces = 6;
            break;
        case MinigameDifficulty.Difficulty.MEDIUM:
            myPuzzles[0].GetComponent<UITexture>().mainTexture = medOutline;
            myPuzzles[0].GetComponent<PuzzlePieceTextureMod>().puzzleOutline = medColored;
            totalPieces = 12;
            break;
        case MinigameDifficulty.Difficulty.HARD:
            myPuzzles[0].GetComponent<UITexture>().mainTexture = hardOutline;
            myPuzzles[0].GetComponent<PuzzlePieceTextureMod>().puzzleOutline = hardColored;
            totalPieces = 20;
            break;
        }

        for(int j = 1; j<myPuzzles.Length; j++)
        {
            myPuzzles[j].SetActive(false);
            mySolutions[j].SetActive(false);

            switch (minigame.difficulty)
            {
            case MinigameDifficulty.Difficulty.EASY:
                myPuzzles[j].GetComponent<UITexture>().mainTexture = easyOutline;
                myPuzzles[j].GetComponent<PuzzlePieceTextureMod>().puzzleOutline = easyColored;
                break;
            case MinigameDifficulty.Difficulty.MEDIUM:
                myPuzzles[j].GetComponent<UITexture>().mainTexture = medOutline;
                myPuzzles[j].GetComponent<PuzzlePieceTextureMod>().puzzleOutline = medColored;
                break;
            case MinigameDifficulty.Difficulty.HARD:
                myPuzzles[j].GetComponent<UITexture>().mainTexture = hardOutline;
                myPuzzles[j].GetComponent<PuzzlePieceTextureMod>().puzzleOutline = hardColored;
                break;
            }
        }

        buttons.SetActive(false);
        hintButton.SetActive(false);

        tutorialHand = GameObject.Find("TutorialHand");
        tutorialHand.SetActive(false);
        tutorialObject = GameObject.Find("PuzzlePiece");
        tutorialObject.SetActive(false);
        tutorialSlot = GameObject.Find("PuzzleSlot");
        tutorialSlot.SetActive(false);

        // Show the instructions of the minigame
        /*if (minigame != null && minigame.StartConversation() == false)
        {
            Debug.Log("S: Knowing when to laugh is puzzling. Complete each puzzle and choose whether you should laugh, or you should help, the people in the image.");
        }
        */
        //minigame.StartConversation();

        if(!minigame.isStandalone()) //if the minigame is part of the story, not free play mode
        {
            Destroy(tutorialOptions);
            Sherlock.Instance.PlaySequenceInstructions(minigame.conversationTree.root, null);
            if(showTutorial)
                StartCoroutine("startTutorial");
            else
                Invoke ("startGame", minigame.conversationTree.root.GetCommulativeDuration() + 1.5f);
        }
    }
Ejemplo n.º 44
0
 public virtual void AddMinigame( Minigame game, Interface inface = null )
 {
     if (inface == null) inface = interface_mouse_screenspace;
     minigames.Add(new MinigameHelper(   game, inface, pool_of_things  ));
 }