Exemple #1
0
    public void useCollectible()
    {
        switch (currentCollectible)
        {
            case CollectibleTypes.CollectibleSpeed:
                SpeedBonus += 20;
                break;

            case CollectibleTypes.CollectibleHeal:
                carHP = HpReturned;
                dealWithHP();
                break;
            case CollectibleTypes.CollectibleNitro:
                carNitro = NitroReturned;
                break;
            case CollectibleTypes.CollectibleNone:
            default:
                break;

        }

        currentCollectible = CollectibleTypes.CollectibleNone;
    }
Exemple #2
0
    void Start()
    {
        currentCollectible = CollectibleTypes.CollectibleNone;
        SpeedBonus = 0;
        PlayerPoints = 0;
        carHP = MAX_CAR_HP;
        carNitro = MAX_CAR_NITRO;
        healthSpeedMultip = 1.0f;

        if (playerNitroSlider != null)
            playerNitroSlider.gameObject.SetActive(true);

        if (playerHPSlider != null)
            playerHPSlider.gameObject.SetActive(true);

        if(speedometer != null)
            speedometer.SetActive(true);

        if(speedometerNeedle != null)
                speedometerNeedle.SetActive(true);
    }
Exemple #3
0
    public void OnTriggerEnter(Collider other)
    {
        string otherTag = other.gameObject.tag;

        if (otherTag.CompareTo("SpeedBonus") == 0)
        {
            SpeedBonus = 15;
            playerPoints += collectiblePoints;
        }
        if (otherTag.CompareTo("CollectibleSpeed") == 0)
        {
            currentCollectible = CollectibleTypes.CollectibleSpeed;
            playerPoints += collectiblePoints;
        }
        if (otherTag.CompareTo("CollectibleHeal") == 0)
        {
            playerPoints += collectiblePoints;
            currentCollectible = CollectibleTypes.CollectibleHeal;
        }
        if (otherTag.CompareTo("CollectibleNitro") == 0)
        {
            playerPoints += collectiblePoints;
            currentCollectible = CollectibleTypes.CollectibleNitro;
        }
        else if (otherTag.CompareTo("checkpoint1") == 0)
        {
            currentLap++;

            lastCheckpoint = other.transform;
            currentCheckpoint = 1;
        }
        else if (otherTag.Contains("checkpoint"))
        {
            string resultString = Regex.Match(otherTag, @"\d+").Value;
            currentCheckpoint = Int32.Parse(resultString);
            lastCheckpoint = other.transform;
        }

        else if (otherTag.CompareTo("MapCollider") == 0)
        {
            mapTriggers++;
            isOutside = false;
            timeOutside = 0;
        }
    }