Example #1
0
        private void OnTrackingFound()
        {
            Renderer[] rendererComponents = GetComponentsInChildren <Renderer>(true);
            Collider[] colliderComponents = GetComponentsInChildren <Collider>(true);
            Canvas[]   canvasComponents   = GetComponentsInChildren <Canvas>(true);

            foreach (Renderer component in rendererComponents)
            {
                component.enabled = false;
            }

            foreach (Collider component in colliderComponents)
            {
                component.enabled = true;
            }

            foreach (Canvas component in canvasComponents)
            {
                component.enabled = true;
            }

            //Debug.Log("X COORD IS " + mTrackableBehaviour.transform.position.x);
            //Debug.Log("Y COORD IS " + mTrackableBehaviour.transform.position.y);
            //Debug.Log("Z COORD IS " + mTrackableBehaviour.transform.position.z);

            if (ProdNametext.GetComponentInChildren <Text>().text == "")
            {
                StartCoroutine(NewFilterProd());
            }
        }
    //! Update the settings based on changes made to the sliders/checkboxes
    void Update()
    {
        PlayerPrefs.SetFloat("music", musicSlider.value);
        PlayerPrefs.SetFloat("fx", fxSlider.value);
        PlayerPrefs.SetInt("skip", skipToggle.isOn ? 1 : 0);

        if (UserSession.user_session != null && UserSession.user_session.user.GetUsername() != "")
        {
            currentloginText.GetComponentInChildren <Text>().text = "Logged in as: ";
            usernameText.GetComponentInChildren <Text>().text     = UserSession.user_session.user.GetUsername();

            if (Server.CheckTwitter())
            {
                linkTwitterButton.SetActive(false);
                unlinkTwitterButton.SetActive(true);
            }
            else
            {
                linkTwitterButton.SetActive(true);
                unlinkTwitterButton.SetActive(false);
            }

            logoutButton.SetActive(true);
        }
        else
        {
            usernameText.GetComponentInChildren <Text>().text     = "";
            currentloginText.GetComponentInChildren <Text>().text = "No login.";
            linkTwitterButton.SetActive(false);
            unlinkTwitterButton.SetActive(false);
            logoutButton.SetActive(false);
        }
    }
Example #3
0
    //start a two player game
    public void TwoPlayerGameStart()
    {
        StartPanel.enabled      = false;
        TwoPlayerButton.enabled = false;
        TwoPlayerButton.GetComponent <Image> ().enabled         = false;
        TwoPlayerButton.GetComponentInChildren <Text>().enabled = false;
        ThreePlayerButton.enabled = false;
        ThreePlayerButton.GetComponent <Image> ().enabled         = false;
        ThreePlayerButton.GetComponentInChildren <Text>().enabled = false;
        PlayerText.enabled = true;
        PlayerText.GetComponentInChildren <Image> ().enabled = true;
        TimeText.enabled = true;
        TimeText.GetComponentInChildren <Image> ().enabled = true;

        //put the hoodles of orange and red players on the board
        for (int i = 0; i < OrangeHoodles.Length; ++i)
        {
            OrangeHoodles [i].SetActive(true);
            OrangeHoodles[i].GetComponent <HoodleMove>().AllowOccupy();
        }
        for (int i = 0; i < RedHoodles.Length; ++i)
        {
            RedHoodles [i].SetActive(true);
            RedHoodles[i].GetComponent <HoodleMove> ().AllowOccupy();
        }

        currPlayer = 0;
        board.setPlayer(currPlayer);
        locker = false;
        mode   = 2;
    }
Example #4
0
    public void ClickingTask()
    {
        if (timeEnded)
        {
            discussText.SetActive(false);
            timeEnded = false;
            StatementTextObject.GetComponentInChildren <Text>().enabled = true;
            agreeBar.SetActive(true);
        }

        hasAccepted = true;

        storyImageSlideController.moveImage++;
        storyImageSlideController.MoveStoryImage();

        if (canClickNext)
        {
            answers.AnswerValueCheck();
            lastStatement = currentStatement;

            StatementTextObject.text = statementText[currentTextIndex];
            currentTextIndex++;
            characterManager.SaveAnswer();
            currentStatement++;
        }

        if (currentTextIndex == 7 || currentTextIndex == 15)
        {
            canClickNext = false;
            StartCoroutine(Wait(5));
            timeEnded = true;
        }

        hasAccepted = false;
    }
Example #5
0
        private void OnTrackingFound()
        {
            Renderer[] rendererComponents = GetComponentsInChildren <Renderer>(true);
            Collider[] colliderComponents = GetComponentsInChildren <Collider>(true);
            Canvas[]   canvasComponents   = GetComponentsInChildren <Canvas>(true);

            foreach (Renderer component in rendererComponents)
            {
                component.enabled = false;
            }

            foreach (Collider component in colliderComponents)
            {
                component.enabled = true;
            }

            foreach (Canvas component in canvasComponents)
            {
                component.enabled = true;
            }

            Debug.Log("X COORD IS " + mTrackableBehaviour.transform.position.x);
            Debug.Log("Y COORD IS " + mTrackableBehaviour.transform.position.y);
            Debug.Log("Z COORD IS " + mTrackableBehaviour.transform.position.z);

            if (ProdNametext.GetComponentInChildren <Text>().text == "")
            {
                StartCoroutine(NewFilterProd("Product Name", RetailIndex.getRetailItemValue(this.gameObject.name.ToString())));
                getFlourLinechart();
            }

            //Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " Found");
        }
Example #6
0
 public void clearText()
 {
     ProdNametext.GetComponentInChildren <Text>().text = "";
     SalesText.GetComponentInChildren <Text>().text    = "";
     AffinityText.GetComponentInChildren <Text>().text = "";
     ShowLinechart = false;
     myLinechart.SetActive(false);
 }
Example #7
0
 public void OpenPopup()
 {
     if (popup != null)
     {
         message.text = playerName.GetComponentInChildren <Text>().text + "님을 퇴장시킵니다.";
         popup.SetActive(true);
     }
 }
 public void InitializeClearButton()
 {
     if (Tutorial.TutorialActive)
     {
         ClearText.GetComponentInChildren <Text>().text = "Skip Tutorial";
     }
     else
     {
         ClearText.GetComponentInChildren <Text>().text = "Clear Grid";
     }
 }
Example #9
0
    void SetupClient()
    {
        Debug.Log(_lazy_game_text.GetComponentInChildren <Text> ().text);
        string[] network_address = _lazy_game_text.GetComponentInChildren <Text>().text.Split(':');


        _client = new NetworkClient();
        _client.RegisterHandler(MsgType.Connect, OnConnected);
        Debug.Log("Ports: " + network_address[1]);
        _client.Connect(network_address[0], int.Parse(network_address[1]));
    }
Example #10
0
 private void languageDropdownValueChangedHandler(Dropdown target)
 {
     if (target.value == 0)
     {
         languageText.GetComponentInChildren <Text>().text = "Please choose a robot / scenario to continue";
     }
     else
     {
         languageText.GetComponentInChildren <Text>().text = "Bitte wählen Sie einen Roboter / ein Szenario aus";
     }
 }
Example #11
0
 private void Odpocznij()
 {
     Clear();
     gracz = GameObject.Find("Gracz");
     btn1.gameObject.SetActive(true);
     btn1.GetComponentInChildren <Text>().text = "Kontynuuj";
     btn1.GetComponent <Button>().onClick.AddListener(delegate { Start(); });
     txt.GetComponentInChildren <Text>().text = "Nasz bohater i jego drużyna są wypoczęci i gotowi na dalsze przygody!";
     GeneratorZmienne.Czas    += 10f;
     GeneratorZmienne.Kondycja = System.Convert.ToInt32(gracz.GetComponent <GraczRuch>().kondycja + GeneratorZmienne.MaxKon());
     GeneratorZmienne.PZ       = System.Convert.ToInt32(gracz.GetComponent <GraczRuch>().hp + GeneratorZmienne.MaxPZ());
 }
Example #12
0
    public void UseUndoPowerUp()
    {
        turn *= -1;

        List <PowerUpBase> playerPowerUps;

        if (turn == 1)
        {
            playerPowerUps = listPowerUp1.GetActivePowerUps();
        }
        else
        {
            playerPowerUps = listPowerUp2.GetActivePowerUps();
        }

        var             undoPowerUp     = playerPowerUps.FirstOrDefault(x => x.GetType().Equals("undo"));
        PowerUpTilesDto powerUpTilesDto = getPowerUpDto(ScoreA: scoreValA, ScoreB: scoreValB, PreviousScoreA: preScoreValA, PreviousScoreB: preScoreValB);

        powerUpTilesDto.PreviousTileArray = previousTileArray;
        powerUpTilesDto = undoPowerUp.Use(powerUpTilesDto);

        if (turn == 1)
        {
            listPowerUp1.DisablePowerUp(undoPowerUp);
        }
        else
        {
            listPowerUp2.DisablePowerUp(undoPowerUp);
        }

        scoreA.GetComponentInChildren <Text>().text = "ScoreA: " + powerUpTilesDto.ScoreA;
        scoreB.GetComponentInChildren <Text>().text = "ScoreB: " + powerUpTilesDto.ScoreB;
        scoreValA = powerUpTilesDto.ScoreA;
        scoreValB = powerUpTilesDto.ScoreB;

        // undoPop.transform.localPosition = new Vector3(0, -380, 0);
        allPopUps.gameObject.SetActive(false);

        undoSuccess = true;
        undoCancel  = true;

        usedPowerUpList.Append("undo|");

        // turn *= -1;
        checkTurnPowerUp();
        turnDisable();
        checkWinCon();

        initializePowerUp();
        EventSystem.current.SetSelectedGameObject(null);
    }
Example #13
0
    void Start()
    {
        for (int i = 0; i < numberOfPlayers; i++)
        {
            UIplayerScores[i].text = GameManager.instance.scores[i].ToString();
        }

        numberOfPlayers = GameManager.instance.numberOfPlayers;
        playerColors    = GameManager.instance.playerColors;

        spawnObjective();
        spawnPlayers();
        UIcenterText.GetComponentInChildren <Image>().sprite = activeObjective;
        sideBarObjectiveImage.sprite = activeObjective;
    }
 //! Keep the logged-in user's username and plays left on the top of the screen
 private void Update()
 {
     if (UserSession.user_session != null && UserSession.user_session.user.GetUsername() != "")
     {
         usernameText.GetComponentInChildren <Text>().text      = UserSession.user_session.user.GetUsername();
         playsUnrankedText.GetComponentInChildren <Text>().text = "" + PlayerSession.player_session.plays_left_unranked;
         playsRankedText.GetComponentInChildren <Text>().text   = "" + PlayerSession.player_session.plays_left_ranked;
     }
     else
     {
         usernameText.GetComponentInChildren <Text>().text      = "<Invalid Session>";
         playsUnrankedText.GetComponentInChildren <Text>().text = "";
         playsRankedText.GetComponentInChildren <Text>().text   = "";
     }
 }
Example #15
0
    private void prepareStatistics()     ///odczytanie zapisanych wynikow rozgrywek oraz przypisanie ich do poszczegolnych tekstow na scenie
    {
        //odczytanie zapisanych wynikow rozgrywek
        int we   = PlayerPrefs.GetInt("easyWin");
        int wm   = PlayerPrefs.GetInt("mediumWin");
        int wh   = PlayerPrefs.GetInt("hardWin");
        int de   = PlayerPrefs.GetInt("easyDraw");
        int dm   = PlayerPrefs.GetInt("mediumDraw");
        int dh   = PlayerPrefs.GetInt("hardDraw");
        int fe   = PlayerPrefs.GetInt("easyFailure");
        int fm   = PlayerPrefs.GetInt("mediumFailure");
        int fh   = PlayerPrefs.GetInt("hardFailure");
        int summ = we + wm + wh + de + dm + dh + fe + fm + fh;

        //przypisanie wynikow do poszczegolnych tekstow na scenie
        allStats.GetComponentInChildren <Text> ().text      = summ.ToString();
        winEasy.GetComponentInChildren <Text> ().text       = we.ToString();
        winMedium.GetComponentInChildren <Text> ().text     = wm.ToString();
        winHard.GetComponentInChildren <Text> ().text       = wh.ToString();
        drawEasy.GetComponentInChildren <Text> ().text      = de.ToString();
        drawMedium.GetComponentInChildren <Text> ().text    = dm.ToString();
        drawHard.GetComponentInChildren <Text> ().text      = dh.ToString();
        failureEasy.GetComponentInChildren <Text> ().text   = fe.ToString();
        failureMedium.GetComponentInChildren <Text> ().text = fm.ToString();
        failureHard.GetComponentInChildren <Text> ().text   = fh.ToString();
    }
Example #16
0
    private void OnEnable()
    {
        List <Player> deathList = PlayerManager.instance.DeadPlayers;

        deathList.Reverse();

        for (int i = 0; i < deathList.Count; i++)
        {
            switch (i)
            {
            case 0:
                firstPosText.text = $"Player {deathList[i].PlayerID}";
                firstPosition.SetActive(true);
                break;

            case 1:
                secondPosText.GetComponentInChildren <Text>().text = $"Player {deathList[i].PlayerID}";
                secondPosition.SetActive(true);
                break;

            case 2:
                thirdPosText.GetComponentInChildren <Text>().text = $"Player {deathList[i].PlayerID}";
                thirdPosition.SetActive(true);
                break;

            case 3:
                fourthPosText.GetComponentInChildren <Text>().text = $"Player {deathList[i].PlayerID}";
                fourthPosition.SetActive(true);
                break;
            }
        }

        winnerPortrait.sprite = deathList[0].GetPlayerCharacterScript.GetSelectPortrait;
    }
Example #17
0
    void CheckInput()
    {
        int index = GetIndexInString(Input.inputString.ToLower());

        if (Input.inputString[0] == text[txtIndex])
        {
            if (index != -1)
            {
                if (keyInstances[index].blockLevel != 0)
                {
                    ChangeStain(index);
                    return;
                }
            }
            inputText.text += text[txtIndex++];
            GameManager.instance.scores++;
            while (text[txtIndex] == ' ' || text[txtIndex] == '\n' || text[txtIndex] == '\t')
            {
                inputText.text += text[txtIndex++];
            }
            nextText.text = "Next: " + text[txtIndex];
            nextText.GetComponentInChildren <ParticleSystem>().Play();
        }
        else
        {
            if (index != -1)
            {
                ChangeStain(index);
            }
        }
    }
Example #18
0
 void UpdateUI()
 {
     if (isOver)
     {
         if (player.isDead == true)
         {
             OverMenuText.GetComponentInChildren <Text>().text = "你被击败了,是否重新来过";
         }
         else
         {
             OverMenu.GetComponentInChildren <Text>().text = "你通过了这关,是否再次挑战";
         }
         OverMenu.SetActive(true);
         Debug.Log("tongguo");
         PauseMenu.SetActive(false);
         Time.timeScale = 0;
         return;
     }
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (PauseMenu.activeSelf == false)
         {
             PauseMenu.SetActive(true);
         }
         else
         {
             PauseMenu.SetActive(false);
         }
     }
 }
// Use this for initialization
    void Awake()
    {
        rb              = GetComponent <Rigidbody>();
        abilityBar      = scoreText.GetComponentInChildren <AbilityCooldowns>();
        inputIdentifier = GameInfo.inputMap[gameObject.name];
        audioSource     = GetComponent <AudioSource>();

        initialPos = rb.position;
        score      = 0;
        setScore(0);
        canMove        = true;
        speed          = 55;
        rb.drag        = 10;
        rb.mass        = 500;
        rb.isKinematic = false;
        scoreText.resizeTextMaxSize = 1;

        //set ability cooldowns
        abilityBar.skills[0].cooldown = 5;  //push cooldown
        abilityBar.skills[1].cooldown = 20; //gravity cooldown

        //configure light settings
        light           = GetComponent <Light>();
        light.color     = GetComponent <Renderer> ().sharedMaterial.GetColor("_Color");
        light.intensity = 0.8f;
        light.range     = 15;
    }
Example #20
0
    // Start is called before the first frame update
    void Start()
    {
        csvTextData = new List <string[]>();
        filePath    = Application.dataPath + "/Resources/" + GameRankFileName + ".csv";

        // Rank UI
        foreach (var i in rankUI.GetComponentsInChildren <Animator>())
        {
            rankUIanimators.Add(i);
        }
        PresentShowRankBarCoroutine = null;

        gameClearInputText.gameObject.SetActive(false);
        bIsQuickPlay = rankReturnHintText.enabled = bIsGameStarted = bIsRankInTop10 = bIsGameClear = false;
        gameTime     = 0.0f;
        UpdateTimeCounterText();
        MovePlayer.OnPlayerReachedGoal    += GameClear;         // Call GameClear func when playe reach goal(check MovePlayer file)
        gameClearInputField                = gameClearInputText.GetComponentInChildren <InputField>();
        gameClearInputField.characterLimit = 10;

        // Create CSV file that holding game rank data
        if (!Resources.Load(GameRankFileName))
        {
            System.IO.File.CreateText(filePath);
        }
        UpdateCsvTextData();
    }
Example #21
0
    // Use this for initialization
    void Start()
    {
        activeMaterial   = Resources.Load <Material> ("Materials/Graphic/Menu Select");
        inactiveMaterial = Resources.Load <Material> ("Materials/Graphic/Menu Select Inactive");

        List <Text> texts = new List <Text>(GetComponentsInChildren <Text> ());

        options = new List <Text> ();
        Text music = texts.FirstOrDefault(t => t.name == "Music");

        options.Add(music);
        sliders.Add(music.GetComponentInChildren <Slider> ());

        Text soundfx = texts.FirstOrDefault(t => t.name == "SoundFX");

        options.Add(soundfx);
        sliders.Add(soundfx.GetComponentInChildren <Slider> ());

        options.Add(texts.FirstOrDefault(t => t.name == "Fullscreen"));
        options.Add(texts.FirstOrDefault(t => t.name == "Resolution"));

        screenOptions = new List <string> ()
        {
            "Fullscreen", "Windowed"
        };
        resolutions = new List <Resolution>(Screen.resolutions);

        base.Start();
    }
Example #22
0
    public void startMission2()
    {
        GameObject     gameManager    = GameObject.FindGameObjectWithTag("GameController");
        GameManager    script         = gameManager.GetComponent <GameManager>();
        CreateMissions createMissions = gameManager.GetComponent <CreateMissions>();

        foreach (GameObject puppet in script.puppets)
        {
            PuppetManager pupje = puppet.GetComponent <PuppetManager>();
            if (!pupje.busy)
            {
                optionalPuppets.Add(puppet);
            }
        }

        int nonBusyPuppetCount = optionalPuppets.Count;

        if (nonBusyPuppetCount > 0)
        {
            int           puppetSelect    = UnityEngine.Random.Range(0, nonBusyPuppetCount);
            GameObject    chosenOne       = optionalPuppets[puppetSelect];
            PuppetManager chosenOneScript = chosenOne.GetComponent <PuppetManager>();
            chosenOneScript.busy      = true;
            chosenOneScript.onMission = true;
            chosenOneScript.startMission(createMissions.missionDuration2, createMissions.missionRisk2,
                                         createMissions.missionReward2, createMissions.missionType2, 2, missionBusy2, missionOverview2);
            optionalPuppets.Clear();
        }
        else
        {
            warning2.GetComponent <CanvasRenderer>().SetAlpha(1f);
            warning2.GetComponentInChildren <Text>().text = "All of your puppets seem to be busy.";
            warning2.CrossFadeAlpha(0.0f, 2.0f, true);
        }
    }
Example #23
0
    public void OnPanicFluidButtonClicked()
    {
        panicFluidFlowEnabled = !panicFluidFlowEnabled;

        string statusText = panicFluidFlowEnabled ? "ON" : "OFF";
        panicFlowButtonText.GetComponentInChildren<Text>().text = "A-Fluid flow : " + statusText;
    }
Example #24
0
 public void DisplayNews(float seconds)                                                     //seconds is the global time in which we know when to trigger which news
 {
     StackSetupTimeEvents(seconds);                                                         //Function draws all the time based news into the Stack in case there exist some at the given timemark
     if (getStackLength() >= 0 && newsCast)                                                 //The empty stack has a value of -1, thus a length of 0 means there is 1 element in the Stack
                                                                                            //newsCast means, that currently there is no newsAnimation running and thus News can be displayed
     {
         for (int i = getStackLength(); i >= 0; i--)                                        //We start working on the stack from the End. Therefor, the last element in the Stack is triggered first
         {
             newsText.GetComponentInChildren <Text>().text = Dicts.dictTexts[newsStack[i]]; //get the NewsText from the Dictonary. First in the newsStack, the i-th element is referenced
                                                                                            //and used as key value to search for the according string in the dictTexts Dictionary
             if (newsCast)
             {
                 AddNewsToNewsBox(i);//We only add news to the NewsBox when the News starts appearing on screen, not before
                 //Following code is used to animate and afterwards destroy the news Panel
                 newsPannel = Instantiate(newsPanel, transform.position = new Vector3(35f, 152f, 0), Quaternion.identity) as GameObject;
                 newsPannel.transform.SetParent(GameObject.Find("MiddleCanvas").transform, false);                               //mittels false skaliert das instantiierte Objekt an den Globalen X und Y, nicht am Parent
                 newsPannel.transform.SetParent(GameObject.Find("NewsPanel").transform, false);
                 delay = GameObject.Find("NewsPanel").GetComponentInChildren <Animator>().GetCurrentAnimatorStateInfo(0).length; //length of the Animator Clip of the Panel
                 StartCoroutine(WaitTimePanelAnimation(delay, i));                                                               //with this syntax we call the IEnumerator WaitTime
                 Destroy(newsPannel, delay);                                                                                     //Delets Object afer "delay" seconds
                 newsCast = false;                                                                                               //bool to false so the animation is not starting again
             }
         }
     }
 }
Example #25
0
    public void Update()
    {
        pedometerPlugin = PedometerPlugin.GetInstance();

        levelObj  = GameObject.Find("level");
        sliderObj = GameObject.Find("xpSlider");

        if (levelObj != null && sliderObj != null)
        {
            //set level text from memory

            //int steps = pedometerPlugin.GetTotalStep() - PlayerPrefs.GetInt ("baseSubtract") - PlayerPrefs.GetInt("berrySpent");
            int stepsXP = pedometerPlugin.GetTotalStep() - PlayerPrefs.GetInt("baseSubtract");

            int   levelNumber = stepsXP / STEPS_PER_XP;
            float toNextLevel = (stepsXP % STEPS_PER_XP) / (float)STEPS_PER_XP;

            Text levelText = levelObj.GetComponent <Text> ();
            levelText.GetComponentInChildren <Text>().text = "" + levelNumber;

            //set xp slider fullness
            Slider xpSlider = sliderObj.GetComponent <Slider>();
            xpSlider.value = toNextLevel;
        }
    }
Example #26
0
    private void Start()
    {
        //populate button list with the buttons
        Button[] btns = this.GetComponentsInChildren <Button>(true);
        for (int i = 0; i < btns.Length; i++)
        {
            buttons.Add(btns[i]);
        }

        //get all button components
        Button ability1 = Ability1.GetComponent <Button>();
        Button ability2 = Ability2.GetComponent <Button>();
        Button ability3 = Ability3.GetComponent <Button>();
        Button ability4 = Ability4.GetComponent <Button>();
        Button ability5 = Ability5.GetComponent <Button>();
        Button ability6 = Ability6.GetComponent <Button>();
        Button ability7 = Ability7.GetComponent <Button>();
        Button reset    = Reset.GetComponent <Button>();
        Button confirm  = Confirm.GetComponent <Button>();
        Text   chosen1  = Chosen1.GetComponentInChildren <Text>();
        Text   chosen2  = Chosen2.GetComponentInChildren <Text>();
        Text   chosen3  = Chosen3.GetComponentInChildren <Text>();

        //add appropriate listeners to the buttons
        ability1.onClick.AddListener(AddOneToBar);
        ability2.onClick.AddListener(AddTwoToBar);
        ability3.onClick.AddListener(AddThreeToBar);
        ability4.onClick.AddListener(AddFourToBar);
        ability5.onClick.AddListener(AddFiveToBar);
        ability6.onClick.AddListener(AddSixToBar);
        ability7.onClick.AddListener(AddSevenToBar);
        reset.onClick.AddListener(resetButton);
        confirm.onClick.AddListener(confirmButton);
    }
    // === MONOBEHAVIOUR METHODS ===

    // Start is called before the first frame update
    private void Start()
    {
        anim         = prompt.GetComponentInChildren <Animation>();
        prompt.text  = "";
        player       = PlayerPrefs.GetInt("CurrentPlayer");
        loadSaveMode = (PlayerPrefs.GetString("CurrentMode"));

        heading.text = "Player " + player + " Saved Games";

        if (loadSaveMode == "load")
        {
            loadSaveButton.text = "LOAD";
            placeholder.text    = "Enter the name of a file to load or select one from the list ...";
        }
        else
        {
            loadSaveButton.text = "SAVE";
            placeholder.text    = "Enter a filename (letters, numbers, _ and - are allowed and filenames must start with a letter) ...";
        }

        string loadPath = "*.p" + player;

        fileList = Directory.GetFiles(Application.persistentDataPath, loadPath);

        for (int i = 0; i < fileList.Length; i++)
        {
            Button newButton = Instantiate(buttonPrefab) as Button;
            newButton.transform.SetParent(contentArea.transform);
            Text   buttonText = newButton.GetComponentInChildren(typeof(Text)) as Text;
            string fname      = Path.GetFileName(fileList[i]).Split('.')[0];
            buttonText.text = fname;
            int fileIndex = i;
            newButton.onClick.AddListener(delegate { FileSelected(fname); });
        }
    }
Example #28
0
    // Start is called before the first frame update
    void Start()
    {
        // Singleton instance
        instance = this;

        bottomLeft = Camera.main.ScreenToWorldPoint(new Vector2(0, 0));
        topRight   = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, Screen.height));

        // Create ball
        Instantiate(ball);

        scoreLimit = 3;

        // Create two paddles
        Paddle paddle1 = Instantiate(paddle) as Paddle;
        Paddle paddle2 = Instantiate(paddle) as Paddle;

        winnerText.GetComponent <Text>().enabled = false;

        score1Text = score1Text.GetComponentInChildren <Text>();

        score1Text.GetComponent <Text>().color = Color.red;
        score2Text.GetComponent <Text>().color = Color.blue;

        paddle1.Init(false); // right paddle
        paddle2.Init(true);  // left paddle

        resetGame();
    }
Example #29
0
    public void AddScore(int amount)
    {
        Image ss  = references["ScoreStar"].GetComponent <Image>();
        Text  st  = references["ScoreText"].GetComponent <Text>();
        Text  hst = references["HighscoreText"].GetComponent <Text>();

        score += amount;

        st.text = score + "";

        if (score > highScore)
        {
            if (ss.sprite != scoreImages[1])
            {
                ss.sprite = scoreImages[1];
                ss.color  = st.color = Color.yellow;
                hst.GetComponentInChildren <ParticleSystem>().Emit(20);
                hst.color = Color.yellow;
                iTween.ScaleFrom(ss.gameObject, new Vector3(2, 2, 2), 0.3f);
                iTween.ScaleFrom(hst.gameObject, new Vector3(2, 2, 2), 0.4f);
                hst.CrossFadeAlpha(0, 2, false);
            }
            highScore = score;
        }
    }
Example #30
0
    // Use this for initialization
    void Start()
    {
        i                     = 0;
        events                = new Events(this);
        showEvents            = true;
        text                  = GameObject.Find("WelcomeText").GetComponent <Text>();
        foodText              = GameObject.Find("FoodValue").GetComponent <Text>();
        buildingMaterialsText = GameObject.Find("BuildMatsValue").GetComponent <Text>();
        moneyText             = GameObject.Find("MoneyValue").GetComponent <Text>();
        turnNumberText        = GameObject.Find("TurnValue").GetComponent <Text>();

        createMissionScript = gameObject.GetComponent <CreateMissions>();

        int playerIdentity = SaveLoadController.control.getPlayerIdentity();

        text.GetComponentInChildren <Text>().text = SaveLoadController.control.getPlayerName(playerIdentity) + "'s village";

        text.CrossFadeAlpha(0.0f, 2.0f, false);

        if (firstPlay == false)
        {
            firstPlay         = true;
            food              = 130;
            buildingMaterials = 100;
            money             = 10;
            puppets           = new List <GameObject>(6);
            buildings         = new ArrayList();
        }

        Invoke("checkSlots", 1);
    }
Example #31
0
	// Use this for initialization
	void Start () {

		hoverImage = GameObject.Find("Image").GetComponent<Image>();

		answer1 = GameObject.Find("answer1_button").GetComponent<Button>();
		answer2 = GameObject.Find("answer2_button").GetComponent<Button>();
		answer3 = GameObject.Find("answer3_button").GetComponent<Button>();
		answer4 = GameObject.Find("answer4_button").GetComponent<Button>();

		questionText = GameObject.Find("question_text").GetComponent<Text>();

		// read settings from file
		string[] preferences = PreferencesManager.read();
		string sound = preferences[0];
		int font_size = int.Parse (preferences[1]);
		timeDelay = int.Parse (preferences[2]);

		// set font size
		answer1.GetComponentInChildren<Text> ().fontSize = font_size;
		answer2.GetComponentInChildren<Text> ().fontSize = font_size;
		answer3.GetComponentInChildren<Text> ().fontSize = font_size;
		answer4.GetComponentInChildren<Text> ().fontSize = font_size;
		questionText.GetComponentInChildren<Text> ().fontSize = font_size;

		questionSetManager = new QuestionSetManager ();
		questionSet = questionSetManager.importQuestions();

		questionIndex = -1;
		timeSinceLastCall = 0f;
		hoverEngaged = false;
		hoverImage.gameObject.SetActive(true);
		hoverImage.fillAmount = 0f;
		hoveredButton = null;
		buttonPressed = false;

		loadNewQuestion();
	}
Example #32
0
 void HideTwoElements(Button btn,Text txt,Button btn2,Text txt2)
 {
     btn.interactable = false;
     txt.GetComponentInChildren<CanvasRenderer>().SetAlpha(0);
     btn2.interactable = false;
     txt2.GetComponentInChildren<CanvasRenderer>().SetAlpha(0);
 }
Example #33
0
 void UnhideElements(Button btn,Text txt,Button btn2,Text txt2,Button btn3,Text txt3)
 {
     btn.interactable = true;
     txt.GetComponentInChildren<CanvasRenderer>().SetAlpha(1);
     btn2.interactable = true;
     txt2.GetComponentInChildren<CanvasRenderer>().SetAlpha(1);
     btn3.interactable = true;
     txt3.GetComponentInChildren<CanvasRenderer>().SetAlpha(1);
 }
Example #34
0
    // Use this for initialization
    void Start()
    {
        BasePlayer pl = GameObject.Find ("Player").GetComponent<BasePlayer> ();
        itemsQuantity = pl.inventory.itemsQuantity;
        itemsData = ItemsData.itemsData;
        initEquipment ();

        presseText = GameObject.Find ("Interface").transform.Find ("PressE").GetComponent<Text> ();
        if (presseText == null) {
            Debug.LogError("presseText");
        }
        presseText.enabled = false;
        presseText.text = "<b>[E]</b> prohledat mrtvolu.";

        lootList = GameObject.Find ("Interface").transform.Find ("LootList").GetComponent<Text> ();
        if (lootList == null) {
            Debug.LogError("lootList");
        }
        lootList.enabled = false;
        lootList.text = "Tohle je konstruktorovej text";

        canvas = GameObject.Find ("Interface").GetComponent<Canvas> ();
        if (canvas == null) {
            Debug.LogError("canvas");
        }
        canvas.enabled = true;

        presseText.GetComponentInChildren<RectTransform>().gameObject.SetActive(false);
        lootList.GetComponentInChildren<RectTransform>().gameObject.SetActive(false);
    }
Example #35
0
 void Start()
 {
     locker = true;
     board = GameObject.FindGameObjectWithTag ("HoldBoard").GetComponent<Board> ();
     PlayerText = GameObject.FindGameObjectWithTag ("PlayerTextTag").GetComponent<Text> ();
     TimeText = GameObject.FindGameObjectWithTag ("TimeTextTag").GetComponent<Text> ();
     PlayerText.enabled = false;
     PlayerText.GetComponentInChildren<Image> ().enabled = false;
     TimeText.enabled = false;
     TimeText.GetComponentInChildren<Image> ().enabled = false;
     DisableAllHoodles ();
     WinText = GameObject.FindGameObjectWithTag ("WinTextTag").GetComponent<Text> ();
     WinPanel = GameObject.FindGameObjectWithTag ("WinPanelTag").GetComponent<Image> ();
     TwoPlayerButton = GameObject.FindGameObjectWithTag ("2PlayerButton").GetComponent<Button> ();
     ThreePlayerButton = GameObject.FindGameObjectWithTag ("3PlayerButton").GetComponent<Button> ();
     StartPanel = GameObject.FindGameObjectWithTag ("StartPanel").GetComponent<Image> ();
     PlayerText.text = playerList[0];
     timer = timeInterval * 60;
     TimeText.text = (timer/60+1).ToString ();
     board.setPlayer (6);
     currPlayer = 6;
 }