Assets/Scripts/Player/Movement/IntermediateSensorManager.cs
/// <summary>
/// if more than half the sensors are on, we assume there is a collision
/// </summary>
if more than half the sensors are on, we assume there is a collision
if more than half the sensors are on we assume there is a collision
void FixedUpdate()
    {
        SensorsOn = 0;
        on = false;
        for (int i = 0; i < ArraySize; i++)
        {
            if (sensorArray[i].GetState())
            {
                SensorsOn += 1;
            }
        }
        if (2 * SensorsOn >= ArraySize)
        {
            on = true;
        }
    }
void FixedUpdate ( ) { SensorsOn = 0 ; on = false ; for ( int i = 0 ; i < ArraySize ; i ++ ) { if ( sensorArray [ i ] . GetState ( ) ) { SensorsOn += 1 ; } } if ( 2 * SensorsOn >= ArraySize ) { on = true ; } }
if more than half the sensors are on, we assume there is a collision
if more than half the sensors are on we assume there is a collision
// detect if really on