Example #1
0
    int totalPressed;                                 //Total score

    // Use this for initialization
    void Start()
    {
        //Initialize variables
        levelTimer     = -1.0f;
        totalPressed   = 0;
        waitTime       = 0.0f;
        timeLeft       = 15.0f;
        timeMultiplier = 1.0f;

        //Set colours
        colourList    = new ButtonColour[9];
        colourList[0] = new ButtonColour("red");
        colourList[1] = new ButtonColour("yellow");
        colourList[2] = new ButtonColour("green");
        colourList[3] = new ButtonColour("lightblue");
        colourList[4] = new ButtonColour("darkblue");
        colourList[5] = new ButtonColour("white");
        colourList[6] = new ButtonColour("purple");
        colourList[7] = new ButtonColour("orange");
        colourList[8] = new ButtonColour("black");

        //Initialize variables
        gameWon     = false;
        gameStarted = false;

        //Hide game over text
        gameOver.enabled = false;
        gameOver.GetComponentInChildren <Text>().enabled = false;
    }
Example #2
0
    void Awake()
    {
        armyMovement      = this.GetComponent <ArmyMovement> ();
        countryManagement = this.GetComponent <CountryManagement> ();
        attack            = this.GetComponent <Attack> ();
        phases            = this.GetComponent <Phases> ();
        audioFadeOut      = this.GetComponent <AudioFadeOut> ();

        GUI          = GameObject.FindGameObjectWithTag("GUI");
        buttonColour = GUI.GetComponent <ButtonColour> ();
    }
Example #3
0
    private void Awake()
    {
        territories    = GameObject.FindGameObjectWithTag("Territories");
        territoryRank  = territories.GetComponent <TerritoryRank>();
        territoryCount = territories.GetComponent <TerritoryCount>();

        scriptHolder = GameObject.FindGameObjectWithTag("ScriptHolder");
        playerTurn   = scriptHolder.GetComponent <PlayerTurn>();

        buttonColour = this.GetComponent <ButtonColour>();
    }
Example #4
0
 //Shuffle a list of colours
 void shuffleColours(ButtonColour[] colourList)
 {
     //Loop through all colours and shuffle them
     for (int i = 0; i < colourList.Length; i++)
     {
         int          rand       = Random.Range(0, i);
         ButtonColour tempColour = colourList[i];
         colourList[i]    = colourList[rand];
         colourList[rand] = tempColour;
     }
 }
Example #5
0
    void Awake()
    {
        GUI              = GameObject.FindGameObjectWithTag("GUI");
        displayEditor    = GUI.GetComponent <DisplayEditor> ();
        buttonColour     = GUI.GetComponent <ButtonColour> ();
        gameInstructions = GUI.GetComponent <GameInstructions> ();

        scriptHolder      = GameObject.FindGameObjectWithTag("ScriptHolder");
        teamChecker       = scriptHolder.GetComponent <TeamChecker> ();
        attack            = scriptHolder.GetComponent <Attack> ();
        countryManagement = scriptHolder.GetComponent <CountryManagement> ();
    }
Example #6
0
    void Awake()
    {
        territories  = GameObject.FindGameObjectWithTag("Territories");
        soldierBonus = territories.GetComponent <SoldierBonus> ();

        GUI          = GameObject.FindGameObjectWithTag("GUI");
        receiveBonus = GUI.GetComponent <ReceiveBonus> ();
        buttonColour = GUI.GetComponent <ButtonColour> ();

        phases     = this.GetComponent <Phases> ();
        playerTurn = this.GetComponent <PlayerTurn> ();
    }
Example #7
0
    void Awake()
    {
        countryManagement = this.GetComponent <CountryManagement> ();
        armyManagement    = this.GetComponent <ArmyManagement> ();
        soldierTransfer   = this.GetComponent <SoldierTransfer> ();

        territories    = GameObject.FindGameObjectWithTag("Territories");
        territoryCount = territories.GetComponent <TerritoryCount> ();
        continentBonus = territories.GetComponent <ContinentBonus> ();

        GUI              = GameObject.FindGameObjectWithTag("GUI");
        buttonColour     = GUI.GetComponent <ButtonColour> ();
        gameInstructions = GUI.GetComponent <GameInstructions> ();
    }
    void Awake()
    {
        scriptHolder     = GameObject.FindGameObjectWithTag("ScriptHolder");
        allocateSoldiers = scriptHolder.GetComponent <AllocateSoldiers> ();
        targetCountry    = scriptHolder.GetComponent <TargetCountry> ();
        phases           = scriptHolder.GetComponent <Phases> ();
        armyMovement     = scriptHolder.GetComponent <ArmyMovement> ();
        playerTurn       = scriptHolder.GetComponent <PlayerTurn> ();
        audioFadeOut     = scriptHolder.GetComponent <AudioFadeOut> ();
        teamChecker      = scriptHolder.GetComponent <TeamChecker> ();

        GUI           = GameObject.FindGameObjectWithTag("GUI");
        displayEditor = GUI.GetComponent <DisplayEditor> ();
        buttonColour  = GUI.GetComponent <ButtonColour> ();
    }
Example #9
0
    void Awake()
    {
        territories = GameObject.FindGameObjectWithTag("Territories");
        troopCount  = territories.GetComponent <TroopCount> ();

        GUI = GameObject.FindGameObjectWithTag("GUI");
        gameInstructions = GUI.GetComponent <GameInstructions> ();
        buttonColour     = GUI.GetComponent <ButtonColour> ();
        displayEditor    = GUI.GetComponent <DisplayEditor> ();

        phases            = this.GetComponent <Phases> ();
        countryManagement = this.GetComponent <CountryManagement> ();
        addSoldier        = this.GetComponent <AddSoldier> ();
        linkedTerritories = this.GetComponent <LinkedTerritories> ();
        playerTurn        = this.GetComponent <PlayerTurn> ();
        teamChecker       = this.GetComponent <TeamChecker> ();
    }
Example #10
0
    void Awake()
    {
        GUI               = GameObject.FindGameObjectWithTag("GUI");
        receiveBonus      = GUI.GetComponent <ReceiveBonus> ();
        gameInstructions  = GUI.GetComponent <GameInstructions> ();
        buttonColour      = GUI.GetComponent <ButtonColour> ();
        openingDeployment = GUI.GetComponent <OpeningDeployment> ();
        endGame           = GUI.GetComponent <EndGame>();
        displayEditor     = GUI.GetComponent <DisplayEditor>();

        territories    = GameObject.FindGameObjectWithTag("Territories");
        territoryCount = territories.GetComponent <TerritoryCount> ();

        playerTurn     = this.GetComponent <PlayerTurn> ();
        deploySoldiers = this.GetComponent <DeploySoldiers> ();
        armyMovement   = this.GetComponent <ArmyMovement> ();
    }
    // Use this for initialization
    void Awake()
    {
        territories    = GameObject.FindGameObjectWithTag("Territories");
        troopCount     = territories.GetComponent <TroopCount> ();
        boardSetUp     = territories.GetComponent <BoardSetUp> ();
        changeCategory = territories.GetComponent <ChangeCatagory> ();

        GUI = GameObject.FindGameObjectWithTag("GUI");
        openingDeployment = GUI.GetComponent <OpeningDeployment> ();
        displayEditor     = GUI.GetComponent <DisplayEditor> ();
        buttonColour      = GUI.GetComponent <ButtonColour> ();

        countryManagement = this.GetComponent <CountryManagement> ();
        playerTurn        = this.GetComponent <PlayerTurn> ();
        teamChecker       = this.GetComponent <TeamChecker> ();
        phases            = this.GetComponent <Phases> ();
        globalFunctions   = this.GetComponent <GlobalFunctions> ();
    }
Example #12
0
    void Awake()
    {
        countryManagement = this.GetComponent <CountryManagement> ();
        phases            = this.GetComponent <Phases> ();
        teamChecker       = this.GetComponent <TeamChecker> ();
        playerTurn        = this.GetComponent <PlayerTurn> ();
        deploySoldiers    = this.GetComponent <DeploySoldiers> ();
        attack            = this.GetComponent <Attack> ();
        audioFadeOut      = this.GetComponent <AudioFadeOut> ();

        territories = GameObject.FindGameObjectWithTag("Territories");
        troopCount  = territories.GetComponent <TroopCount> ();

        GUI           = GameObject.FindGameObjectWithTag("GUI");
        displayEditor = GUI.GetComponent <DisplayEditor> ();
        receiveBonus  = GUI.GetComponent <ReceiveBonus> ();
        buttonColour  = GUI.GetComponent <ButtonColour> ();
    }
Example #13
0
    //Update all button colours
    void updateColours()
    {
        //Shuffle colours
        shuffleColours(colourList);

        //Set colours
        setColours();

        //Select random colour from shuffled list
        int randColour = Random.Range(0, 8);

        newColour = colourList[randColour];

        //Set indicator to chosen colour
        indicator.GetComponent <Image>().color         = newColour.colour;
        indicator.GetComponentInChildren <Text>().text = "";

        //Button pressed is false
        buttonPressed = false;
    }
Example #14
0
 public bool Equals(PopupButton other)
 {
     return(ButtonColour.Equals(other.ButtonColour) &&
            ButtonTextColour.Equals(other.ButtonTextColour) &&
            ButtonText.Equals(ButtonText));
 }
 private void Awake()
 {
     buttonColour = this.GetComponent <ButtonColour>();
 }
    public override void Start()
    {
        base.Start();
        string name = string.Format("{0} #{1}", Connector.KMBombModule.ModuleDisplayName, Connector.ModuleID);

        _gameInfo = GetComponent <KMGameInfo>();
        _bombInfo = GetComponent <KMBombInfo>();

        _translation = GetComponent <TranslatedTheButton> ();
        _translation.GenerateLanguage(name);
        LanguageTheButton language = _translation.Language;

        // Sets the appearance of the button
        Connector.SetColour(_color = (ButtonColour)Random.Range(0, 4));

        _label = (ButtonLabel)Random.Range(0, 4);
        if (_translation.Language.DisplayMethod == LanguageTheButton.DisplayMethods.CustomTextMesh)
        {
            Connector.SetLabel(language.GetLabelFromEnglishName(_label.ToString()), language.Font, language.FontMaterial, language.GetSizeFromEnglishName(_label.ToString()));
        }
        else
        {
            Connector.SetLabel(language.GetLabelFromEnglishName(_label.ToString()));
        }

        LogFormat(language.RuleColorIs, language.GetLogFromEnglishName(_color.ToString()));
        LogFormat(language.RuleLabelIs, language.GetLogFromEnglishName(_label.ToString()));
        LogFormat(language.RuleButtonShouldBe, (ShouldBeHeld() ? language.RuleHeld : language.RulePressed));

        // Register button hold and released events
        Connector.Held     += Button_In;
        Connector.Released += Button_Out;

        // todo: this seems not needed anymore. Maybe for sprites.
        // Hide our custom text mesh/sprite in the dark.
        //if (_translation.Language.DisplayMethod != LanguageTheButton.DisplayMethods.Default) {
        //	if (_color == ButtonColour.Blue || _color == ButtonColour.Red) {
        //		_gameInfo.OnLightsChange += Connector.ToggleLabel;
        //		Connector.ToggleLabel(false);
        //	}
        //}

        TwitchHelpMessage = string.Format("{1}, {2} - !{0} tap | !{0} hold | !{0} release 7 (releases when there's a 7 in the timer)", "{0}", _translation.Language.NativeName, _translation.Language.Name);

        // Stuff regarding the cover
        var moduleSelectable = GetComponent <KMSelectable>();

        _buttonSelectable            = moduleSelectable.Children[0];
        moduleSelectable.OnHighlight = () => { if (OpenCoverOnSelection)
                                               {
                                                   Connector.OpenCover();
                                               }
        };
        _buttonSelectable.OnHighlight = () => { if (OpenCoverOnSelection)
                                                {
                                                    Connector.OpenCover();
                                                }
        };
        moduleSelectable.OnHighlightEnded = () => { if (OpenCoverOnSelection)
                                                    {
                                                        Connector.CloseCover();
                                                    }
        };
        _buttonSelectable.OnHighlightEnded = () => { if (OpenCoverOnSelection)
                                                     {
                                                         Connector.CloseCover();
                                                     }
        };
        moduleSelectable.OnCancel = () => { Connector.CloseCover(); return(true); };         // Twitch Plays
        if (Application.isEditor)
        {
            // Things work a bit differently in the test harness from the actual game.
            // TODO: There is currently an issue whereby going from one module to another does not call any event.
            moduleSelectable.OnInteract = () => { if (!OpenCoverOnSelection)
                                                  {
                                                      Connector.OpenCover();
                                                  }
                                                  return(true); };
        }
        else
        {
            OpenCoverOnSelection     = Connector.ShouldOpenCoverOnSelection;
            moduleSelectable.OnFocus = () => { if (!OpenCoverOnSelection)
                                               {
                                                   Connector.OpenCover();
                                               }
            };
            moduleSelectable.OnDefocus = () => Connector.CloseCover();
        }
    }