コード例 #1
0
ファイル: Pathing.cs プロジェクト: isuyou/BuildABot
 private void checkLight(float time)
 {
     if (stopLight != null)
     {
         Stoplight stopScript = (Stoplight)stopLight.GetComponent("Stoplight");
         if (stopScript.stop)
         {
             if (ProximityTester.proximityTest(stoplightProximityRange, this.transform.position, stopLight.transform.position))
             {
                 //car stops in place until light is go
                 if (!hasLogged)
                 {
                     Debug.Log("stop");
                 }
                 hasLogged = true;
             }
             else
             {
                 checkCarCollision(time);
             }
         }
         else
         {
             checkCarCollision(time);
         }
     }
     else
     {
         checkCarCollision(time);
     }
 }
コード例 #2
0
ファイル: Pathing.cs プロジェクト: isuyou/BuildABot
 private void checkCarCollision(float time)
 {
     if (otherCars != null)
     {
         foreach (GameObject otherCar in otherCars)
         {
             if (ProximityTester.proximityMagnitudeTest(carCollisionProximityRange, this.transform.position, otherCar.transform.position))
             {
                 return;
             }
         }
     }
     moveCheck(time);
 }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        float time = Time.deltaTime;

        if (!willChange && playerCar != null)
        {
            if (ProximityTester.proximityMagnitudeTest(proximityRange, this.transform.position, playerCar.transform.position))
            {
                willChange = true;
            }
        }
        if (willChange && totalTime < moveTime)
        {
            Move(time);
            totalTime += time;
        }
    }
コード例 #4
0
    // Update is called once per frame
    void Update()
    {
        float time = Time.deltaTime;

        if (!willChange && playerCar != null)
        {
            if (ProximityTester.proximityTest(proximityRange, this.transform.position, playerCar.transform.position))
            {
                willChange = true;
            }
        }
        if (willChange && numChanges < maxNumChanges)
        {
            if (totalTime > timeToChangeLight[numChanges])
            {
                ChangeLight();
                numChanges++;
            }
            totalTime += time;
        }
    }