コード例 #1
0
    private void calculateScore(Event e)
    {
        //int scoreBefore = Score;

        switch (e.type)
        {
        case Event.TYPE.kill:


            if (e.enemy == "B055")
            {
                scoreContainer.addBossKills(1);
                Score += 2500;
                WaveCounterManager.instance.ScorePopup(2500);
            }

            if (e.character == "LineSystem")    // || e.character == "laser_trap"
            {
                Score += 100;
                scoreContainer.addCutKills(1);
                WaveCounterManager.instance.ScorePopup(100);
            }
            break;

        case Event.TYPE.superAbility:
            int n = 0;

            if (e.kills != null)
            {
                n += (int)e.kills * 100;
                scoreContainer.addPolyKills((int)e.kills);
            }
            scoreContainer.addPolysTriggered(1);
            Score += 1000 + n;
            //WaveCounterManager.instance.ScorePopup(1000 + n);
            break;

        case Event.TYPE.death:
            playerDeathsInWave++;
            break;

        case Event.TYPE.powerup:
            Score += 100;
            scoreContainer.addPowerupsCollected(1);
            WaveCounterManager.instance.ScorePopup(100);
            break;

        case Event.TYPE.waveUp:
            if (e.wave != 1)
            {
                if (playerDeathsInWave != 0)
                {
                    Score -= 1000 * playerDeathsInWave;
                    scoreContainer.addPlayerRevials(playerDeathsInWave);
                    WaveCounterManager.instance.ScorePopup(-1000 * playerDeathsInWave);
                }
                Score += 10000;
            }
            //resourceValueBefore = 0;
            //intermediateScore -= entireInterpolationAddition;
            //scoreBefore = Score;
            intermediateScore  = Score;
            playerDeathsInWave = 0;
            break;

        case Event.TYPE.sessionEnd:
            float wave = Event.getWave();
            scoreContainer.setWave(wave);
            if (e.playerCount != null)
            {
                scoreContainer.setPlayerCount((int)e.playerCount);
            }
            else
            {
                Debug.LogError("[DataCollector] no player count found in sessionEnd event");
            }
            scoreContainer.setLevelName(e.level);

            int s = (int)((wave - (int)wave) * 10000);
            Score += s;

            e.addScore(Score);

            if (GameManager.gameManagerInstance.CurrentGameMode == GameMode.YOLOMode)
            {
                scoreContainer.setGameMode(GameMode.YOLOMode);
                scoreContainer.setYoloTime(e.time);
            }
            else
            {
                scoreContainer.setGameMode(GameMode.NormalMode);
            }

            if (DataCollector.instance.eventBuild)
            {
                scoreContainer.setGameName(e.name);
            }


            Debug.Log(scoreContainer.ToString());

            /*
             * Debug.Log("[DataCollector] wave " + wave);
             * Debug.Log("[DataCollector] score " + Score);
             * Debug.Log("[ScoreContainer] score " + scoreContainer.getScoreSum());
             */

            break;
        }
        //Debug.Log("[Score]" + (Score - scoreBefore));
        //intermediateScore += Score - scoreBefore;
    }