示例#1
0

        
示例#2
0
    private void OnTriggerEnter(Collider other)
    {
        Train train = other.GetComponent <Train>();

        if (train)
        {
            Race          race         = train.GetRace();
            Destination[] destinations = race.GetDestinations();

            bool match = destinations.ToList().Exists(destination => Destination.Match(this.destination, destination));
            if (match)
            {
                scoreCounter.Add(REWARD);
            }
            else
            {
                scoreCounter.Add(-REWARD);
                livesCounter.LoseLive();
            }
            train.Destroy();
        }
    }