public void Update(MySmallShipBot bot, MyEntity entityTarget) { var smallShipTarget = entityTarget as MySmallShip; if (!m_followPosition.HasValue && !m_lookingForPosition && m_followPath == null && !m_lookingForPath) { if (smallShipTarget != null) { // Start looking for visible route position m_lookingForPosition = bot.TryFindRoute(smallShipTarget); } else { // No remembered position pathfinding m_lookingForPath = bot.TryFindPath(entityTarget.WorldAABB.GetCenter()); } } else if (m_lookingForPosition) { CheckIfRoutePositionComputed(bot, entityTarget); } else if (!m_lookingForPosition && m_followPosition.HasValue) { FollowToRoutePosition(bot); } else if (m_lookingForPath) { CheckIfPathComputed(bot); } else if (!m_lookingForPath && m_followPath != null) { FollowPath(bot); } }