Пример #1
0
    void UpdateScoreText()
    {
        var gmData = GameDataSerializer.LoadGameData(LevelManager.GetLevelNum());

        if (gmData != null)
        {
            _score.text = gmData.playerScore.ToString();
        }
    }
Пример #2
0
    private void TallyScore()
    {
        var end    = GameDataSerializer._gameDataList.Count - 1;
        var gmData = GameDataSerializer.LoadGameData(end);

        PlayerScore        = NumPickupsCollected * 10000;
        gmData.playerScore = PlayerScore;

        Debug.Log("The final score is " + PlayerScore.ToString());
        Debug.Log("The player has collected " + NumPickupsCollected.ToString() + " pickups");
    }
Пример #3
0
    private void Awake()
    {
        _pickupList     = new List <GameObject>();
        _pickupPosList  = new List <Vector3>();
        _pickupBoolList = new List <bool>();

        NumPickupsCollected = 0;
        NumPickupsLost      = 0;
        LastCollectedPos    = new Vector3(0.0f, 0.0f, 0.0f);
        LastPickupBool      = false;

        var end    = GameDataSerializer._gameDataList.Count - 1;
        var gmData = GameDataSerializer.LoadGameData(end);

        if (gmData.playerScore > 0)
        {
            PlayerScore = gmData.playerScore;
        }
        else
        {
            PlayerScore = 0;
        }

        foreach (var obj in FindObjectsOfType <GameObject>())
        {
            if (obj.tag == TagStatics.GetPickupTag())
            {
                _pickupPosList.Add(obj.transform.position);
                _pickupList.Add(obj);
                obj.GetComponent <SphereHandler>().OnPickupCollectedEvent += UpdatePickupList;
            }
        }

        NumPickupsInLevel = _pickupList.Count;

        if (_pickupList.Count <= 0)
        {
            Debug.LogWarning("PickupManager didn't find any valid pickups within the current level");
            Debug.LogWarning("Did you forget to tag any Pickup prefab instances in the scene as Pickup?");
        }


        Debug.Log("Pickup list contains " + _pickupList.Count + " pickups");
    }
Пример #4
0
 // Start is called before the first frame update
 void Start()
 {
     _txt.text += " " + GameDataSerializer.LoadGameData(LevelManager.GetLevelNum()).numPickupsLost;
 }