示例#1
0
    private void OnLevelEnd(bool obj)
    {
        var playerChoiceData = new PlayerChoiceData();

        playerChoiceData.enduranceUpgradeCount  = enduranceUpgradeCount;
        playerChoiceData.productionUpgradeCount = productionUpgradeCount;
        playerChoiceData.unitPercentChanged     = unitPercentChangeCount;
        playerChoiceData.timeFor25Unit          = unitPercentTimes[0];
        playerChoiceData.timeFor50Unit          = unitPercentTimes[1];
        playerChoiceData.timeFor75Unit          = unitPercentTimes[2];
        playerChoiceData.timeFor100Unit         = unitPercentTimes[3];

        Analytics.SendPlayerChoiceData(playerChoiceData);

        var lvlEndData = new LevelEndData();

        lvlEndData.playTime = LevelController.PlayTime;

        int totalUnitProduced = 0;
        var towers            = TowerController.GetAllTowers();

        foreach (var t in towers)
        {
            if (t.Faction == FactionController.PlayerFaction)
            {
                lvlEndData.playerControlledPlanets++;
            }
            else if (t.Faction == FactionController.NeutralFaction)
            {
                lvlEndData.neutralPlanets++;
            }
            else if (t.Faction == FactionController.OtherFaction1)
            {
                lvlEndData.opponentControlledPlanets++;
            }

            totalUnitProduced += t.Generator.TotalProduced;
        }

        if (obj)
        {
            lvlEndData.statusCode = LevelStatusCode.Victory;
        }
        else
        {
            lvlEndData.statusCode = LevelStatusCode.Defeat;
        }

        if (convergenceDefeat)
        {
            lvlEndData.statusCode = LevelStatusCode.Tie;
        }

        if (levelQuit)
        {
            lvlEndData.statusCode = LevelStatusCode.Surrender;
        }

        lvlEndData.unitsCreated   = totalUnitProduced;
        lvlEndData.unitsDestroyed = unitsDestroyed;

        Analytics.SendLevelEnd(lvlEndData);
    }
示例#2
0
 public void TakePlayerChoiceAction(int actionId, PlayerChoiceData data)
 {
     TakeAction(actionId, data);
 }
示例#3
0
 public static void SendPlayerChoiceData(PlayerChoiceData data)
 {
     CheckResult(UnityEngine.Analytics.Analytics.CustomEvent("Player Choices", data.ToDictionary()));
 }