예제 #1
0
    void OnEnable()
    {
        if (achievementHandler == null)
        {
            achievementHandler = GameObject.Find("Achievement Handler").GetComponent <Achievement_Script> ();
        }
        //minus 3 because the default pieceset, splitter, and symbol piecesets are unlocked at the start
        int totalTally    = achievementHandler.splittersUnlocked.Length + achievementHandler.piecesetsUnlocked.Length - 3;
        int unlockedTally = -3;

        foreach (bool isUnlocked in achievementHandler.splittersUnlocked)
        {
            if (isUnlocked)
            {
                unlockedTally++;
            }
        }
        foreach (bool isUnlocked in achievementHandler.piecesetsUnlocked)
        {
            if (isUnlocked)
            {
                unlockedTally++;
            }
        }
        UnlockedText.text = unlockedTally.ToString();
        OutOfText.text    = totalTally.ToString();
    }
예제 #2
0
    public RuntimeAnimatorController Get_Splitter_Animation()
    {
        if (achievementHandler == null)
        {
            achievementHandler = GameObject.FindGameObjectWithTag("Achievement Handler").GetComponent <Achievement_Script> ();
        }
        int index = achievementHandler.Splitter_Lookup_Index_by_Name(PlayerPrefs.GetString("Splitter Type", "Default"));

        return(SplitterAnimations [index]);
    }
예제 #3
0
    //returns sprite for currently active splitter
    public Sprite Get_Splitter()
    {
        if (achievementHandler == null)
        {
            achievementHandler = GameObject.FindGameObjectWithTag("Achievement Handler").GetComponent <Achievement_Script> ();
        }
        int index = achievementHandler.Splitter_Lookup_Index_by_Name(PlayerPrefs.GetString("Splitter Type", "Default"));

        return(Splitters [index]);
    }
예제 #4
0
 // Use this for initialization
 void Start()
 {
     achievementHandler = GameObject.FindGameObjectWithTag("Achievement Handler").GetComponent <Achievement_Script> ();
     if (PieceSet == "")
     {
         PieceSet = PlayerPrefs.GetString("Piece Set", "Default");
     }
     if (SplitterType == "")
     {
         SplitterType = PlayerPrefs.GetString("Splitter Type", "Default");
     }
 }
    // Use this for initialization
    void Start()
    {
        gameObject.GetComponent <Image> ().sprite = GameObject.Find("Piece Sprite Holder").GetComponent <Piece_Sprite_Holder> ().Get_Splitter();
        pieceSpriteHolder  = GameObject.Find("Piece Sprite Holder").GetComponent <Piece_Sprite_Holder> ();
        htpSplitter.sprite = pieceSpriteHolder.Get_Splitter();

        achievementHandler = GameObject.FindGameObjectWithTag("Achievement Handler").GetComponent <Achievement_Script> ();

        headerText.text = PlayerPrefs.GetString("Splitter Type", "Default");
        index           = achievementHandler.Splitter_Lookup_Index_by_Name(headerText.text);

        image = gameObject.GetComponent <Image> ();
    }
예제 #6
0
    // Use this for initialization
    void Start()
    {
        achievementHandler = GameObject.FindGameObjectWithTag("Achievement Handler").GetComponent <Achievement_Script> ();
        headerText.text    = PlayerPrefs.GetString("Piece Set", "Default");
        switch (headerText.text)
        {
        case "Default":
            index = 0;
            break;

        case "Arcane":
            index = 1;
            break;

        case "Retro":
            index = 2;
            break;

        case "Programmer":
            index = 3;
            break;

        case "Blob":
            index = 4;
            break;

        case "Domino":
            index = 5;
            break;

        case "Present":
            index = 6;
            break;

        case "Pumpkin":
            index = 7;
            break;

        case "Symbol":
            index = 8;
            break;

        case "Techno":
            index = 9;
            break;

        default:
            index = 0;
            break;
        }
    }
예제 #7
0
    // Use this for initialization
    void Start()
    {
        GameObject GPGHObject = GameObject.FindGameObjectWithTag("Google Play");

        if (GPGHObject == null)
        {
            Destroy(gameObject);
            return;
        }
        else
        {
            gpgh = GPGHObject.GetComponent <GPG_Handler>();
        }
        bts = GetComponent <Button_Image_Swapper> ();
        if (gpgh.isLoggedIn)
        {
            GPActive = true;
            bts.Change_Image(0);
        }
        else
        {
            GPActive = false;
            bts.Change_Image(1);
        }


        // make sure the button has the correct functions loaded
        Button button = GetComponent <Button> ();

        switch (type)
        {
        case "Games":
            button.onClick.AddListener(() => gpgh.Show_Notification());
            break;

        case "Leaderboards":
            button.onClick.AddListener(() => gpgh.Show_Leaderboards());
            break;

        case "Achievements":
            achievementHandler = GameObject.FindGameObjectWithTag("Achievement Handler").GetComponent <Achievement_Script>();
            button.onClick.AddListener(() => gpgh.Show_Achievements());
            button.onClick.AddListener(() => achievementHandler.Sync_With_Google_Play());
            break;

        default:
            button.onClick.AddListener(() => gpgh.Show_Notification());
            break;
        }
    }
예제 #8
0
 // Use this for initialization
 void Start()
 {
     animator           = GetComponent <Animator> ();
     spriteRenderer     = gameObject.GetComponent <SpriteRenderer> ();
     achievementHandler = GameObject.Find("Achievement Handler").GetComponent <Achievement_Script> ();
     SplitterType       = PlayerPrefs.GetString("Splitter Type", "Default");
     if (SplitterType == "Programmer")
     {
         Destroy(gameObject);
         return;
     }
     index = achievementHandler.Splitter_Lookup_Index_by_Name(SplitterType);
     animator.runtimeAnimatorController = wedgeAnimators [index];
     spriteRenderer.sprite = IdleSprites [index];
 }
예제 #9
0
    // Use this for initialization
    void Start()
    {
        gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController> ();
        if (gameController.gameType != "Wiz" && gameController.gameType != "Holy")
        {
            Destroy(gameObject);
            return;
        }

        foreach (GameObject yse in yellowSpellEffects)
        {
            yse.GetComponent <SpriteRenderer>().sprite = null;
        }

        achievementHandler = GameObject.FindGameObjectWithTag("Achievement Handler").GetComponent <Achievement_Script> ();

        spellHandler = GameObject.Find("Spell Handler").GetComponent <SpellHandler> ();
    }
예제 #10
0
    // Use this for initialization
    void Start()
    {
        highScoreCalculator = GameObject.Find("High Score Calculator").GetComponent <High_Score_Calculator> ();
        //first check if they're using the most recent version of the game
        if (PlayerPrefs.GetInt("Version", 0) != versionNumber)
        {
            highScoreCalculator.Reset_All_Scores();
            foreach (High_Score_Displayer hsd in hsds)
            {
                hsd.update_scores();
            }
            PlayerPrefs.SetInt("Version", versionNumber);
        }
        achievementHandler = GameObject.Find("Achievement Handler").GetComponent <Achievement_Script> ();
        gpgNotification    = GameObject.Find("Google Play Notification").GetComponent <GPG_Notification> ();
        Goto_Game_Mode_Layer();
        shutter.Begin_Vertical_Open();

        GameObject MCobject = GameObject.FindGameObjectWithTag("Music Controller");

        mc = MCobject.GetComponent <Music_Controller> ();

        mc.Play_Music("Menu");

        //just in case this is the first time playing, set Wiz to be for sure unlocked
        PlayerPrefs.SetInt("Wiz unlocked", 1);
        //tell achievmement handler to check gamemodes that are supposed to be active
        achievementHandler.Check_Gamemode_Unlocked();

        activeMode = 0;
        prevMode   = 0;
        ScrollDown.BroadcastMessage("FadeOut", null, SendMessageOptions.DontRequireReceiver);
        for (int i = 0; i < 4; i++)
        {
            OrigButtonSprite[i] = GameButtons[i].GetComponent <Image>().sprite;
            OrigDescText[i]     = Descriptions[i].GetComponent <Text>().text;
        }
        GameMode_Unlocker();

        if (PlayerPrefs.GetInt("Played Before", 0) == 1)
        {
            Destroy(HTPEmphasizer);
        }
    }
예제 #11
0
    // Use this for initialization
    void OnEnable()
    {
        if (achievementHandler == null)
        {
            achievementHandler = GameObject.Find("Achievement Handler").GetComponent <Achievement_Script> ();
        }
        NameText        = transform.GetChild(0).GetComponent <Text> ();
        HintText        = transform.GetChild(1).GetComponent <Text> ();
        UnlockableImage = transform.GetChild(2).GetComponent <Image> ();

        //check if it's unlocked depending on what it is
        if (isSplitter)
        {
            unlocked = achievementHandler.is_Splitter_Unlocked(unlockable);
        }
        else
        {
            unlocked = achievementHandler.is_Pieceset_Unlocked(unlockable);
        }

        //if it's unlocked, update with the right info
        if (unlocked)
        {
            NameText.text          = AchievementName;
            HintText.text          = AchievementCondition;
            UnlockableImage.sprite = UnlockableSprite;
            UnlockableImage.color  = new Color(1, 1, 1, 1);
        }
        //if it isn't unlocked, hide it and give the player the hint found in the unity GUI for this gameobject
        else
        {
            NameText.text          = "???????";
            HintText.text          = AchievementHint;
            UnlockableImage.sprite = UnlockableSprite;
            UnlockableImage.color  = new Color(0, 0, 0, 1);
        }
    }
예제 #12
0
    void Awake()
    {
        if (SceneManager.GetActiveScene().name == "Split Title Scene")
        {
            SceneManager.UnloadScene("Split Title Scene");
        }
        achievementHandler = GameObject.FindGameObjectWithTag("Achievement Handler").GetComponent <Achievement_Script> ();

        //begin with the assumption that you're not in quick mode and there's not countdown
        isCountingDown = false;

        switch (PlayerPrefs.GetInt("Mode", 0))
        {
        case 0:
            gameType = "Wiz";
            break;

        case 1:
            gameType = "Quick";
            break;

        case 2:
            gameType = "Wit";
            break;

        case 3:
            gameType = "Holy";
            break;
        }

        mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera> ();

        //let's grab the music controller
        GameObject MCobject = GameObject.FindGameObjectWithTag("Music Controller");

        mc = MCobject.GetComponent <Music_Controller> ();

        //reposition score to wherever it may be
        scoreText.transform.GetComponent <BoxCollider2D> ().offset = (mainCamera.ViewportToWorldPoint(scoreText.transform.position))
                                                                     - scoreText.transform.position;

        multiRun = false;
        //instantiate the grids with their appropriate starting values
        for (int r = 0; r <= 7; r++)
        {
            for (int c = 0; c <= 15; c++)
            {
                grid[r, c]      = null;
                colorGrid[r, c] = null;
                checkGrid[r, c] = false;
            }
            cluster[r] = null;
        }

        multiplier    = 1;
        checkGameOver = false;
        piecesPlaced  = 0;
        checkFlag     = false;
        movesMade     = 0;
        score         = 0;
        //load the splitter with the spawned splitter object
        GameObject splitterObject = GameObject.Find("Splitter");

        if (splitterObject != null)
        {
            splitter = splitterObject.GetComponent <Splitter_script>();
        }

        gameOver = false;
        //load the side columns if they exist
        sideColumns [0] = null;
        sideColumns [1] = null;
        GameObject[] scols = GameObject.FindGameObjectsWithTag("Side Column");
        GameObject   spellHandlerObject = GameObject.Find("Spell Handler");

        spellHandler = spellHandlerObject.GetComponent <SpellHandler> ();
        if (gameType == "Wit")
        {
            availableCount = 8;

            //no powers in Wit
            Destroy(spellHandlerObject);

            //Wit does not use the sidecolumns, get rid of them
            Destroy(scols[1]);
            Destroy(scols[0]);
            mc.Play_Music(gameType);
        }
        else if (gameType == "Quick")
        {
            availableCount = 4;
            if (scols [0] != null && scols [1] != null)
            {
                //make sure they're loaded properly, left is 0, right is 1
                if (scols[0].GetComponent <SideColumn>().sideInt == 0)
                {
                    sideColumns[0] = scols[0].GetComponent <SideColumn>();
                    sideColumns[1] = scols[1].GetComponent <SideColumn>();
                }
                else
                {
                    sideColumns[0] = scols[1].GetComponent <SideColumn>();
                    sideColumns[1] = scols[0].GetComponent <SideColumn>();
                }
            }
            quickMoveSides = false;
            StartCoroutine("StartingCountDown");
            splitter.setState("canShoot", false);

            // no powers in Quick, only Holy and Wiz
            Destroy(spellHandlerObject);
        }
        else if (gameType == "Wiz")
        {
            //powers are in Wiz, start out with 5 kinds of blocks
            availableCount = 5;
            if (scols [0] != null && scols [1] != null)
            {
                //make sure they're loaded properly, left is 0, right is 1
                if (scols[0].GetComponent <SideColumn>().sideInt == 0)
                {
                    sideColumns[0] = scols[0].GetComponent <SideColumn>();
                    sideColumns[1] = scols[1].GetComponent <SideColumn>();
                }
                else
                {
                    sideColumns[0] = scols[1].GetComponent <SideColumn>();
                    sideColumns[1] = scols[0].GetComponent <SideColumn>();
                }
            }
            spellHandler.redReady    = true;
            spellHandler.orangeReady = false;
            spellHandler.yellowReady = true;
            spellHandler.greenReady  = true;
            spellHandler.blueReady   = true;
            spellHandler.purpleReady = true;
            spellHandler.cyanReady   = false;
            spellHandler.whiteReady  = false;
            mc.Play_Music(gameType);
        }
        else if (gameType == "Holy")
        {
            //Holy has everything at once. Essentially hard mode
            availableCount = 8;
            if (scols [0] != null && scols [1] != null)
            {
                //make sure they're loaded properly, left is 0, right is 1
                if (scols[0].GetComponent <SideColumn>().sideInt == 0)
                {
                    sideColumns[0] = scols[0].GetComponent <SideColumn>();
                    sideColumns[1] = scols[1].GetComponent <SideColumn>();
                }
                else
                {
                    sideColumns[0] = scols[1].GetComponent <SideColumn>();
                    sideColumns[1] = scols[0].GetComponent <SideColumn>();
                }
            }
            spellHandler.redReady    = true;
            spellHandler.orangeReady = true;
            spellHandler.yellowReady = true;
            spellHandler.greenReady  = true;
            spellHandler.blueReady   = true;
            spellHandler.purpleReady = true;
            spellHandler.cyanReady   = true;
            spellHandler.whiteReady  = true;
            mc.Play_Music(gameType);
        }

        if (gameType != "Wit" && sideColumns != null && sideColumns[0].side == "Right")
        {
            SideColumn temp = sideColumns[0];
            sideColumns[0] = sideColumns[1];
            sideColumns[1] = temp;
        }
        sidesChecked = false;

        //initially update the moves and scores
        updateMoves();
        updateScore();

        //get the pause stuff in order
        isPaused = false;
        GameOverLayer.SetActive(false);
        shutter.Begin_Horizontal_Open();

        //high score stuff
        newHighScore       = false;
        HighScoreText.text = "";
        tipText.text       = "";
        Score_Text_Canvas  = GameObject.Find("Score Text Canvas");
    }