Ejemplo n.º 1
0
 public void Force_data_into_storage(VehiclePart[] _parts)
 {
     Attempt_store_new_data(_parts);
     for (int _partIndex = 0; _partIndex < _parts.Length; _partIndex++)
     {
         VehiclePart _PART = _parts[_partIndex];
         _PART.transform.position = _PART.destination;
         _PART.ClearDestination();
     }
 }
Ejemplo n.º 2
0
    private void UpdateBot()
    {
        Vector3 botDest;

        if (factor < ANIM_RANGE_FETCH)
        {
            botDest = Vector3.Lerp(nav_parts_IN.position, fetchLine_pos_START, factor / ANIM_RANGE_FETCH);
        }
        else if (factor < ANIM_RANGE_LOAD)
        {
            botDest = fetchLine_pos_START;
            // move parts to bot
            for (int _slotIndex = 0; _slotIndex < lineLength; _slotIndex++)
            {
                VehiclePart _PART = Get_data_slot(targetStorageLine, _slotIndex);
                if (_PART != null)
                {
                    if (parts_OUT.Contains(_PART))
                    {
                        Vector3 _PART_START_POS = storageLines[targetStorageLine].slotPositions[_slotIndex];
                        Vector3 _PART_END_POS   = storageBot.slots[_slotIndex].position;
                        _PART.ClearDestination();
                        _PART.transform.position = Vector3.Lerp(_PART_START_POS, _PART_END_POS, (factor - ANIM_RANGE_FETCH) / (ANIM_RANGE_LOAD - ANIM_RANGE_FETCH));
                    }
                }
            }
        }
        else if (factor < ANIM_RANGE_DELIVER)
        {
            botDest = Vector3.Lerp(fetchLine_pos_START, nav_parts_OUT.position, (factor - ANIM_RANGE_LOAD) / (ANIM_RANGE_DELIVER - ANIM_RANGE_LOAD));
            // keep parts with bot
            for (int _slotIndex = 0; _slotIndex < lineLength; _slotIndex++)
            {
                VehiclePart _PART = Get_data_slot(targetStorageLine, _slotIndex);
                if (_PART != null)
                {
                    if (parts_OUT.Contains(_PART))
                    {
                        _PART.ClearDestination();
                        _PART.transform.position = storageBot.slots[_slotIndex].position;
                    }
                }
            }
        }
        else
        {
            botDest = nav_parts_OUT.position;
            // stack parts
            for (int _slotIndex = 0; _slotIndex < lineLength; _slotIndex++)
            {
                VehiclePart _PART = Get_data_slot(targetStorageLine, _slotIndex);
                if (_PART != null)
                {
                    if (parts_OUT.Contains(_PART))
                    {
                        Vector3 _PART_START_POS = storageBot.slots[_slotIndex].position;
                        Vector3 _PART_END_POS   = sendingLineTo.nav_parts_IN.position + new Vector3(0f, (float)_slotIndex * 0.25f, 0f);

                        _PART.ClearDestination();
                        _PART.transform.position = Vector3.Lerp(_PART_START_POS, _PART_END_POS, (factor - ANIM_RANGE_DELIVER) / (1f - ANIM_RANGE_DELIVER));
                    }
                }
            }
        }
        storageBot.Destination = botDest;
    }