public void TryCreateObstacle(MyEntity newEntity) { if (((newEntity.Physics != null) && (newEntity is MyCubeGrid)) && (newEntity.PositionComp != null)) { IMyObstacle entity = MyObstacleFactory.CreateObstacleForEntity(newEntity); if (entity != null) { this.m_obstacles.Add(entity); } } }
public void TryCreateObstacle(MyEntity newEntity) { if (newEntity.Physics == null) { return; } if (!(newEntity is MyCubeGrid)) { return; } if (newEntity.PositionComp == null) { return; } var obstacle = MyObstacleFactory.CreateObstacleForEntity(newEntity); if (obstacle != null) { m_obstacles.Add(obstacle); } }