Exemple #1
0
    public ShipPart LaunchRandomPartToTarget(Vector3 target)
    {
        if (availableParts.Count <= 0)
        {
            return(null);
        }
        ShipPart part = GetRandomPart();
        Vector3  dir  = target - part.transform.position;

        if (dir.magnitude < 0.01f)
        {
            dir = Vector2.down;
        }

        Vector3 force = dir.normalized * 6.5f * dir.magnitude;

        part.Launch(force, shipParts, target);
        availableParts.Remove(part);

        UpdateLifeSupportStatus();
        UpdateReadyToWarp();
        return(part);
    }