Пример #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Racket")
        {
            switch (itemCode)
            {
            case POINT_100:
                mainManager.AddGameScore(100);
                prefabSounds.GetPoint();
                break;

            case POINT_200:
                mainManager.AddGameScore(200);
                prefabSounds.GetPoint();
                break;

            case POINT_500:
                mainManager.AddGameScore(500);
                prefabSounds.GetPoint();
                break;

            case POINT_1000:
                mainManager.AddGameScore(1000);
                prefabSounds.GetPoint();
                break;

            case EXPAND_RACKET:
                racket.Expand();
                break;

            case SHRINK_RACKET:
                if (signalManager.IsActiveTrapGuard())
                {
                    prefabSounds.GetNothing();
                }
                else
                {
                    racket.Shrink();
                }
                break;

            case EXTRA_BALL:
                mainManager.AddRestOfBall();
                prefabSounds.GetExtraBall();
                break;

            case POWER_UP:
                signalManager.StartPoweredBall(1000);
                break;

            case PROTECTOR:
                signalManager.StartProtector(750);
                break;

            case LEVEL_UP:
                mainManager.AddJackpotScore(100);
                mainManager.LevelUp();
                break;

            case TRAP_GUARD:
                signalManager.StartTrapGuard(1500);
                break;

            case GAME_OVER:
                if (signalManager.IsActiveTrapGuard())
                {
                    prefabSounds.GetNothing();
                }
                else
                {
                    mainManager.StartGameOver();
                }
                break;

            case PRECIPITATE:
                signalManager.StartPrecipitate(1500);
                break;

            case SHOOTING:
                signalManager.StartShooting(750);
                break;

            case HOSTAGE_300:
                mainManager.AddGameScore(300);
                prefabSounds.GetPoint();
                break;

            case NEGATIVE_POINT_200:
                if (signalManager.IsActiveTrapGuard())
                {
                    prefabSounds.GetNothing();
                }
                else
                {
                    mainManager.AddGameScore(-200);
                }
                break;

            case FLASH:
                if (signalManager.IsActiveTrapGuard())
                {
                    prefabSounds.GetNothing();
                }
                else
                {
                    mainManager.StartFlash();
                }
                break;

            case COUNTERFEIT:
                if (signalManager.IsActiveTrapGuard())
                {
                    prefabSounds.GetNothing();
                }
                else
                {
                    mainManager.AddGameScore(-1000);
                    signalManager.StopAllSignals();
                    racket.SetStepOfLength(1);
                    prefabSounds.GetCounterfeit();
                }
                break;

            case MAGNET:
                signalManager.StartMagnet(1000);
                break;

            case STICKY:
                signalManager.StartSticky(1500);
                break;

            case DECELERATE:
                ball.Decelerate();
                break;

            case ACCELERATE:
                if (signalManager.IsActiveTrapGuard())
                {
                    prefabSounds.GetNothing();
                }
                else
                {
                    ball.Accelerate();
                }
                break;

            case MAX_SPEED:
                if (signalManager.IsActiveTrapGuard())
                {
                    prefabSounds.GetNothing();
                }
                else
                {
                    ball.MaxSpeed();
                }
                break;
            }
            Destroy(this.gameObject);
        }
        if (collision.gameObject.tag == "FailZone")
        {
            switch (itemCode)
            {
            case EXTRA_BALL:
                //複雑なシステムに使う
                break;

            case HOSTAGE_300:
                mainManager.MissingHostage300();
                break;
            }
            Destroy(this.gameObject);
        }
    }