예제 #1
0
    //get the right shape to check if it match
    public void ButtonClick(int vButtonIndex)
    {
        //can only destroy enemy when in range
        if (vCurEnemy.Count > 0 && GameStarted)
        {
            //get current shape of the enemy to compare
            cEnemy vEnemyFound = GetMatchingEnemy(vButtonIndex);

            //make sure color + shape match
            if (vEnemyFound != null)
            {
                //make the beam the same color
                vBeamLight.GetComponent <SpriteRenderer> ().color = vEnemyFound.vShape.vColor;

                //show the animation!
                vBeamAnimator.SetTrigger("LaunchBeam");

                //destroy current enemy in line
                vEnemyFound.GetComponent <Animator>().SetTrigger("Die");

                //remove itself from the spawnlist
                foreach (GameManager2D.cSpawnList vList in vSpawnList)
                {
                    if (vList.vSpawnList.Contains(vEnemyFound.gameObject))
                    {
                        vList.vSpawnList.Remove(vEnemyFound.gameObject);
                    }
                }

                //remove itself from the vCurEnemy
                vCurEnemy.Remove(vEnemyFound);

                //enemy die, so increase value
                EnemyDied();
            }
        }
    }
예제 #2
0
    public void GameOver(cEnemy vEnemy)
    {
        //need to wait for the gameover animation to finish before clicking
        WaitForGameOver = true;

        //remove other text
        vAlertText.SetActive(false);

        //stop the game
        GameStarted = false;

        //hide game over message
        vGameOverText.SetActive(true);

        //play sound
        PlaySound(vSndGameOver, 1f);

        //make sure dying enemy is above everything else
        vEnemy.vBorder.sortingOrder = 101;
        vEnemy.vInside.sortingOrder = 100;

        //make the target go VERY big
        vEnemy.GetComponent <Animator> ().SetTrigger("GameOver");

        //hide
        vBlackBackground.SetActive(false);

        //go back to 2 buttons
        vButtonAnimator.SetBool("2Buttons", true);

        //hide button
        foreach (GameObject vButton in vButtonsList)
        {
            vButton.SetActive(false);
        }
    }