public bool ProcessCurrentAndNextPathPositionAndOtherVehicleCurrentAndNextPathPosition(ref Vehicle vehicleData, byte index, ref PathUnit.Position otherVehicleCurPos, ref PathUnit.Position otherVehicleNextPos, ref Vehicle otherVehicleData, QuadPathPositionProcessor processor) { if (index < 11) { return(ProcessPathUnitQuad(ref vehicleData, ref Singleton <PathManager> .instance.m_pathUnits.m_buffer[vehicleData.m_path], ref Singleton <PathManager> .instance.m_pathUnits.m_buffer[vehicleData.m_path], index, ref otherVehicleData, ref otherVehicleCurPos, ref otherVehicleNextPos, processor)); } else { return(ProcessPathUnitQuad(ref vehicleData, ref Singleton <PathManager> .instance.m_pathUnits.m_buffer[vehicleData.m_path], ref Singleton <PathManager> .instance.m_pathUnits.m_buffer[Singleton <PathManager> .instance.m_pathUnits.m_buffer[vehicleData.m_path].m_nextPathUnit], index, ref otherVehicleData, ref otherVehicleCurPos, ref otherVehicleNextPos, processor)); } }
private bool ProcessPathUnitQuad(ref Vehicle firstVehicleData, ref PathUnit unit1, ref PathUnit unit2, byte index, ref Vehicle secondVehicleData, ref PathUnit.Position secondPos1, ref PathUnit.Position secondPos2, QuadPathPositionProcessor processor) { if ((unit1.m_pathFindFlags & PathUnit.FLAG_READY) == 0) { return(false); } if ((unit2.m_pathFindFlags & PathUnit.FLAG_READY) == 0) { return(false); } switch (index) { case 0: processor(ref firstVehicleData, ref unit1.m_position00, ref unit1.m_position01, ref secondVehicleData, ref secondPos1, ref secondPos2); break; case 1: processor(ref firstVehicleData, ref unit1.m_position01, ref unit1.m_position02, ref secondVehicleData, ref secondPos1, ref secondPos2); break; case 2: processor(ref firstVehicleData, ref unit1.m_position02, ref unit1.m_position03, ref secondVehicleData, ref secondPos1, ref secondPos2); break; case 3: processor(ref firstVehicleData, ref unit1.m_position03, ref unit1.m_position04, ref secondVehicleData, ref secondPos1, ref secondPos2); break; case 4: processor(ref firstVehicleData, ref unit1.m_position04, ref unit1.m_position05, ref secondVehicleData, ref secondPos1, ref secondPos2); break; case 5: processor(ref firstVehicleData, ref unit1.m_position05, ref unit1.m_position06, ref secondVehicleData, ref secondPos1, ref secondPos2); break; case 6: processor(ref firstVehicleData, ref unit1.m_position06, ref unit1.m_position07, ref secondVehicleData, ref secondPos1, ref secondPos2); break; case 7: processor(ref firstVehicleData, ref unit1.m_position07, ref unit1.m_position08, ref secondVehicleData, ref secondPos1, ref secondPos2); break; case 8: processor(ref firstVehicleData, ref unit1.m_position08, ref unit1.m_position09, ref secondVehicleData, ref secondPos1, ref secondPos2); break; case 9: processor(ref firstVehicleData, ref unit1.m_position09, ref unit1.m_position10, ref secondVehicleData, ref secondPos1, ref secondPos2); break; case 10: processor(ref firstVehicleData, ref unit1.m_position10, ref unit1.m_position11, ref secondVehicleData, ref secondPos1, ref secondPos2); break; case 11: processor(ref firstVehicleData, ref unit1.m_position11, ref unit2.m_position00, ref secondVehicleData, ref secondPos1, ref secondPos2); break; default: return(false); } return(true); }
public bool ProcessCurrentAndNextPathPositionAndOtherVehicleCurrentAndNextPathPosition(ref Vehicle vehicleData, ref PathUnit.Position otherVehicleCurPos, ref PathUnit.Position otherVehicleNextPos, ref Vehicle otherVehicleData, QuadPathPositionProcessor processor) { return(ProcessCurrentAndNextPathPositionAndOtherVehicleCurrentAndNextPathPosition(ref vehicleData, (byte)(vehicleData.m_pathPositionIndex >> 1), ref otherVehicleCurPos, ref otherVehicleNextPos, ref otherVehicleData, processor)); }