Beispiel #1
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        if (gameMaster.gamePaused == false && gameMaster.gameOn == true)
        {
            if (collision.gameObject.tag == "Bowl")
            {
                audioSource.volume = soundsController.soundEffectsVolume;
                audioSource.PlayOneShot(catchClip);

                if (isDiamond == true)
                {
                    gameMaster.AddDiamonds(1);
                }
                else if (isDirty == true)
                {
                    gameMaster.DamagePlayer(1);
                }
                else
                {
                    gameMaster.AddScore(1);
                }
                Destroy(gameObject);
            }
        }
    }
Beispiel #2
0
 void Death()
 {
     deathCanvas.SetActive(true); //display game over text
     gameObject.SetActive(false); //delete the player
     gm.Stop();                   //stop game
     gm.AddScore(gm.Score());
 }
Beispiel #3
0
 private void Death()
 {
     GameMaster.AddScore(_bossClass.ScoreValue);
     DeathEffect(_bossClass.DeathPrefab, _bossClass.DurationOfDeathEffect,
                 _bossClass.DeathSound, _bossClass.DeathSoundVolume);
     Destroy();
 }
Beispiel #4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.transform.tag == "Player")
        {
            if (!CHECKED)
            {
                CHECKED = true;
                if (GM.ladderCount < GM.maxLadder)
                {
                    //GM.ladderCount++;
                    GetComponent <CustomAudioSource> ().PlayOnce();
                    GetComponent <SpriteRenderer> ().enabled = false;

                    GameObject pickup = Instantiate(UIPICKUP, transform.position, Quaternion.identity) as GameObject;

                    Destroy(this.gameObject, 0.204f);
                }
                else if (GM.ladderCount >= GM.maxLadder)
                {
                    GM.AddScore(10);
                    GetComponent <CustomAudioSource> ().PlayOnce();
                    GetComponent <SpriteRenderer> ().enabled = false;
                    Destroy(this.gameObject, 0.204f);
                }
            }
        }
    }
Beispiel #5
0
    public void Eat()
    {
        ms = MoveScore.EAT;

        stepsWithoutFood = 0;

        GameObject go = Instantiate(goBodyPrefab, sbSnakeTail.transform.position, Quaternion.identity);
        SnakeBody  sb = go.GetComponent <SnakeBody>();

        SnakeId.GetInstance().SetHighScore(apples + 1);
        GameMaster.AddScore(1);

        if (length == 1)
        {
            sbSnakeHead.back = sb;
            sb.front         = sbSnakeHead;
            sbSnakeTail      = sb;
        }
        else
        {
            sbSnakeTail.back = sb;
            sb.front         = sbSnakeTail;
            sbSnakeTail      = sb;
        }

        apples++;
        length++;
    }
Beispiel #6
0
    private void HandleShowResult(ShowResult result)
    {
        switch (result)
        {
        case ShowResult.Finished:
            Debug.Log("The ad was successfully shown.");
            switch (reward)
            {
            case "diamond":
                Debug.Log("Add diamonds");
                gameMaster.AddDiamonds(1);
                break;

            case "dubbleWaterdrops":
                Debug.Log("Dubble score");
                gameMaster.SaveWaterdrops();
                gameMaster.AddScore(gameMaster.score);
                break;
            }
            break;

        case ShowResult.Skipped:
            Debug.Log("The ad was skipped before reaching the end.");
            break;

        case ShowResult.Failed:
            Debug.LogError("The ad failed to be shown.");
            break;
        }
    }
Beispiel #7
0
    public void DestroyCarScore()
    {
        Vector3 carPos = Camera.main.WorldToScreenPoint(transform.position);

        GM.AddScore((moveSpeed == 6) ? 30 : 50, carPos.x, carPos.y); //30 score for normal cars, 50 score for FBI car
        GameObject carExp = Instantiate(carExplotion, transform.position, Quaternion.identity) as GameObject;

        Destroy(gameObject);
    }
Beispiel #8
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            if (other.GetComponent <PlayerController> ().shovelCount < 3)
            {
                //other.GetComponent<PlayerController> ().shovelCount++;

                GameObject pickup = Instantiate(UIPICKUP, transform.position, Quaternion.identity) as GameObject;
            }
            else if (other.GetComponent <PlayerController> ().shovelCount >= 3)
            {
                GM.AddScore(50);
            }
            Destroy(this.gameObject);
        }
    }
Beispiel #9
0
    public void ContactCheck()
    {
        for (int i = 0; i < hices.Length; i++)
        {
            if (hices[i].HexColor == HexColor.None)
            {
                continue;
            }
            if (hices[i].Vanished)
            {
                continue;
            }
            RefreshChecked();
            hices[i].StartCountCheck();
        }
        // Vanishing Check
        var vanishingSum = 0;

        for (int i = 0; i < hices.Length; i++)
        {
            if (hices[i].HexColor == HexColor.None)
            {
                continue;
            }
            if (!hices[i].Vanishing)
            {
                continue;
            }
            vanishingSum++;
            hices[i].Vanishing = false;
            hices[i].Vanished  = true;
        }
        if (vanishingSum > 0)
        {
            // Chain
            // Debug.Log($"{ChainNum} Chain!:{vanishingSum}");
            if (vanishingSum < 3)
            {
                Debug.LogError("Chain Error");
            }
            for (int j = 0; j < hices.Length; j++)
            {
                // if(hices[j].Vanished) Debug.Log($"{j}:(React:{hices[j].ReactContact})");
            }
            var addScore = gameMaster.AddScore(vanishingSum, ChainNum);
            earnedScore.PopUp(ChainNum, vanishingSum, addScore);
            shake.ShakeByChain(ChainNum);
            ChainNum++;
            var scoreStruct = new ScoreStruct(vanishingSum, ChainNum - 1, addScore);
            var cleard      = missionBoardMaster.MissionCheck(scoreStruct);
            if (cleard)
            {
                gameMaster.AddTime();
                audioMaster.PlayClear();
            }
            perform.InitWait();
            gameMaster.PuzzleState = PuzzleState.Effect;
            gameMaster.StopTimer();
        }
        else
        {
            // Chain end
            // Elase Vanished Panel
            var shouldPlaySound = false;
            for (int i = 0; i < hices.Length; i++)
            {
                if (hices[i].HexColor == HexColor.None)
                {
                    continue;
                }
                hices[i].Vanishing = false;
                if (!hices[i].Vanished)
                {
                    continue;
                }
                hices[i].Vanished = false;
                hices[i].SetHex(HexColor.None);
                shouldPlaySound = true;
            }
            gameMaster.PuzzleState = PuzzleState.Play;
            if (shouldPlaySound)
            {
                audioMaster.PlayVanish();
            }
            gameMaster.StartTimer();
        }
    }