Example #1
0
    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.tag == "Trigger/StartGame")
        {
            if (EventManager.OnGameStart != null)
            {
                EventManager.OnGameStart();
            }
        }


        if (col.gameObject.tag == "Trigger/StopProgressionCollider")
        {
            cameraController.InStopZone = true;
        }

        if (col.gameObject.tag == "Objects/Car")
        {
            if (EventManager.OnLogMapStat != null)
            {
                EventManager.OnLogMapStat(MapUnlockConditions.SpecialConditionType.CarsCrashed, 1);
            }

            if (FuryHandler.InFury)
            {
                TriggerVehicleCrash(col);
            }
            else
            {
                if (furyHitThresholdReach)
                {
                    player.VehicleDurability--;

                    GameController.Instance.damageDone = (int)GameController.ActiveModel.durability.value - (int)player.VehicleDurability;

                    if (player.VehicleDurability < 0)
                    {
                        if (GameController.Instance.CanDie)
                        {
                            Death(col);
                        }

                        player.VehicleDurability = 0;
                    }
                    else
                    {
                        TriggerVehicleCrash(col);
                    }

                    if (EventManager.OnVehicleHit != null)
                    {
                        EventManager.OnVehicleHit();
                    }

                    col.gameObject.GetComponent <Car>().CarHit = true;
                    col.gameObject.GetComponent <Car>().ParentCarStream.ParentSection.CarHitAtLight = true;
                }
            }
        }

        if (col.gameObject.tag == "Objects/Gear")
        {
            int gearMult = FuryHandler.InFury ? 2 : 1;

            GameController.Instance.gearsCollected += gearMult;

            Gear gear = col.gameObject.transform.GetComponent <Gear>();

            //gear.Toggle(false);

            gear.Animate();

            if (EventManager.OnGearTriggerHit != null)
            {
                EventManager.OnGearTriggerHit();
            }
        }
    }