示例#1
0
 private void TearDownTrack()
 {
     BehaviorUtils.MakeVisible(GameObject.Find(RaceTrackName), false);
     foreach (string name in CarNames)
     {
         GameObject car = GameObject.Find(name);
         car.GetComponent <CarController>().Reset();
         BehaviorUtils.MakeVisible(car, false);
     }
 }
示例#2
0
 private void RemoveCarFor(string participantId)
 {
     foreach (string name in CarNames)
     {
         GameObject    obj = GameObject.Find(name);
         CarController cc  = obj.GetComponent <CarController>();
         if (participantId.Equals(cc.ParticipantId))
         {
             BehaviorUtils.MakeVisible(obj, false);
         }
     }
 }
示例#3
0
    private void SetupTrack()
    {
        BehaviorUtils.MakeVisible(GameObject.Find(RaceTrackName), true);
        Debug.Log("About to get self");
        Participant self = GetSelf();

        Debug.Log("Self is " + self);
        Debug.Log("About to get a list of connected participants");
        List <Participant> racers = GetRacers();

        Debug.Log("Racers is  " + racers + " with count of " + racers.Count);
        int i;

        for (i = 0; i < CarNames.Length; i++)
        {
            Debug.Log("Looking at i value of " + i);
            GameObject car = GameObject.Find(CarNames[i]);
            Debug.Log("Looking for car name " + CarNames[i]);
            Participant racer = i < racers.Count ? racers[i] : null;
            Debug.Log("Racer is " + racer);

            bool isSelf = racer != null && racer.ParticipantId.Equals(self.ParticipantId);
            if (racer != null)
            {
                Debug.Log("Racer is not null!");
                BehaviorUtils.MakeVisible(car, true);
                CarController controller = car.GetComponent <CarController>();
                controller.SetParticipantId(racer.ParticipantId);
                controller.SetBlinking(isSelf);
            }
            else
            {
                Debug.Log("Hiding racer");
                BehaviorUtils.MakeVisible(car, false);
            }
        }
    }
 private void MakeVisible(bool visible)
 {
     BehaviorUtils.MakeVisible(gameObject, visible);
 }
 void Start()
 {
     BehaviorUtils.MakeVisible(gameObject, false);
 }