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; } }
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); }
public bool IsAccessPointCompatible(NpcAccessPoint.AccessPointType apType) { foreach (var compatibleAP in compatibleAccessPoints) { if (apType.Equals(compatibleAP)) { return(true); } } return(false); }
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); }