Exemplo n.º 1
0
    public void Dock(NpcAccessPoint.AccessPointType dockingType)
    {
        Debug.Log("Ship is ready to dock");
        switch (dockingType)
        {
        case NpcAccessPoint.AccessPointType.Planet:
            Destroy(gameObject);
            break;

        case NpcAccessPoint.AccessPointType.SpaceStation:
            Destroy(gameObject);
            break;

        case NpcAccessPoint.AccessPointType.Warp:
            if (_warpDrive != null)
            {
                _warpDrive.ExitToWarp();
            }
            else
            {
                Debug.LogError("NPC could not enter warp because the Warp Drive was null");
            }
            break;
        }
    }
Exemplo n.º 2
0
    public void Dock(NpcAccessPoint.AccessPointType type)
    {
        _dockedAPType = type;
        _isActive     = false;
        var duration      = 2f / rotateSpeed;
        var positionTween = transform.positionTo(duration, _destination.position);

        transform.rotationTo(duration, Quaternion.LookRotation(-_destination.forward).eulerAngles);
        positionTween.setOnCompleteHandler(InPositionToDock);
    }
Exemplo n.º 3
0
 public bool IsAccessPointCompatible(NpcAccessPoint.AccessPointType apType)
 {
     foreach (var compatibleAP in compatibleAccessPoints)
     {
         if (apType.Equals(compatibleAP))
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 4
0
    private List <CompleteNpc> GetPrefabsForAccessPointType(NpcAccessPoint.AccessPointType type)
    {
        List <CompleteNpc> compatibleNPCs = new List <CompleteNpc>();

        foreach (var npc in npcs)
        {
            if (npc.Type.IsAccessPointCompatible(type))
            {
                if (npc.Count < npc.maxCount)
                {
                    compatibleNPCs.Add(npc);
                }
            }
        }

        return(compatibleNPCs);
    }