示例#1
0
 void Start()
 {
     floor10x8   = GameObject.FindGameObjectsWithTag("Floor10x8");
     floor8x5    = GameObject.FindGameObjectsWithTag("Floor8x5");
     gm          = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
     fire        = GameObject.FindGameObjectWithTag("Fire").GetComponent <Fire>();
     previousPos = transform.position;
     r2          = raySensor.GetRayPerceptionInput();
     exits       = GameObject.FindGameObjectsWithTag("Exit");
 }
 public List<float> GetSensorData()
 {
     // check for the sensor data
     RayPerceptionInput input = distanceSensorComponent.GetRayPerceptionInput();
     RayPerceptionOutput output = RayPerceptionSensor.Perceive(input);
     var list = output.RayOutputs;
     //RayPerceptionOutput.RayOutput output0 = (RayPerceptionOutput.RayOutput)list.GetValue(0);
     //print(output0.HitFraction);
     List<float> hitFractions = new List<float>();
     foreach (var listItem in list)
     {
         RayPerceptionOutput.RayOutput outputRef = (RayPerceptionOutput.RayOutput)listItem;
         hitFractions.Add(outputRef.HitFraction);
     }
     return hitFractions;
 }