Example #1
0
    public DockRequestResult MidwayDock(ShipBase requester, out DockSessionBase session, int direction)
    {
        Debug.LogError("Midway dock " + ID);
        if (direction == -1)
        {
            if (_dockingStageA > 0 || _sessionA != null)
            {
                session = null;
                return(DockRequestResult.Busy);
            }
            DockingEffectA.SetStage(2);
            _dockingStageA = 3;
            _sessionA      = new TLTransitSession(requester, -1, this);
            session        = _sessionA;
            _sessionA.StartMidwaySession();
            return(DockRequestResult.Accept);
        }
        else if (direction == 1)
        {
            if (_dockingStageB > 0 || _sessionB != null)
            {
                session = null;
                return(DockRequestResult.Busy);
            }
            DockingEffectB.SetStage(2);
            _dockingStageB = 3;
            _sessionB      = new TLTransitSession(requester, 1, this);
            session        = _sessionB;
            _sessionB.StartMidwaySession();
            return(DockRequestResult.Accept);
        }

        session = null;
        return(DockRequestResult.Deny);
    }
Example #2
0
    public void SpawnPlayer()
    {
        Debug.Log("Spawning in station " + GameManager.Inst.PlayerProgress.SpawnStationID);
        StationBase     station = GameObject.Find(GameManager.Inst.PlayerProgress.SpawnStationID).GetComponent <StationBase>();
        DockSessionBase session = null;

        station.Undock(PlayerShip, out session);
    }
Example #3
0
 public override DockRequestResult Dock(ShipBase requester, out DockSessionBase session)
 {
     Debug.Log("Begin docking at jumpgate " + this.ID);
     IsGateActive = true;
     _activeTimer = 0;
     session      = null;
     return(DockRequestResult.Accept);
 }
Example #4
0
    public override DockRequestResult Undock(ShipBase requester, out DockSessionBase session)
    {
        Vector3 spawnLoc = DockingTrigger.transform.position + SpawnDisposition;

        requester.transform.position = spawnLoc;
        requester.transform.rotation = Quaternion.LookRotation(DockingTrigger.transform.up, Vector3.up);
        session = null;
        return(DockRequestResult.Accept);
    }
Example #5
0
 public override BTResult Exit(BTResult result)
 {
     //Debug.LogError("BTDockAtNextNode: " + result + " " + MyAI.MyShip.name);
     MyAI.Whiteboard.Parameters["IgnoreAvoidance"] = false;
     _currentSession = null;
     _waitDistance   = 0;
     _dockingStage   = 0;
     _dockStart      = null;
     return(result);
 }
Example #6
0
    public override DockRequestResult Undock(ShipBase requester, out DockSessionBase session)
    {
        //find an available gate
        DockGate selectedGate = FindAvailableGate();

        if (selectedGate == null)
        {
            session = null;
            return(DockRequestResult.Busy);
        }

        session = new DockingSession(selectedGate, requester, this, true);
        _dockingSessions.Add((DockingSession)session);

        return(DockRequestResult.Accept);
    }
Example #7
0
    public override DockRequestResult Dock(ShipBase requester, out DockSessionBase session)
    {
        //determine direction from requester's location
        float angleA = Vector3.Angle(TriggerA.transform.forward, TriggerA.transform.position - requester.transform.position);
        float angleB = Vector3.Angle(TriggerB.transform.forward, TriggerB.transform.position - requester.transform.position);



        if (angleA < 90 && IsTerminalAorB >= 0)
        {
            //Debug.Log("Docking requested to go to A");
            //direction is going towards A
            //check if anyone is already docking A
            if (_dockingStageA > 0 || _sessionA != null)
            {
                session = null;
                return(DockRequestResult.Busy);
            }
            DockingEffectA.SetStage(1);
            _dockingStageA = 1;
            _sessionA      = new TLTransitSession(requester, -1, this);
            session        = _sessionA;
            return(DockRequestResult.Accept);
        }
        else if (angleB < 90 && IsTerminalAorB <= 0)
        {
            Debug.Log("Docking requested to go to B");
            //directoin is going towards B
            if (_dockingStageB > 0 || _sessionB != null)
            {
                session = null;
                return(DockRequestResult.Busy);
            }
            DockingEffectB.SetStage(1);
            _dockingStageB = 1;
            _sessionB      = new TLTransitSession(requester, 1, this);
            session        = _sessionB;
            return(DockRequestResult.Accept);
        }

        session = null;
        return(DockRequestResult.Deny);
    }
Example #8
0
    public override DockRequestResult Dock(ShipBase requester, out DockSessionBase session)
    {
        //check if requester is allowed to dock

        //find an available gate
        DockGate selectedGate = FindAvailableGate();

        if (selectedGate == null)
        {
            session = null;
            return(DockRequestResult.Busy);
        }

        DockingSession stationSession = new DockingSession(selectedGate, requester, this, false);

        _dockingSessions.Add(stationSession);
        session = stationSession;

        return(DockRequestResult.Accept);
    }
Example #9
0
 public override void Initialize()
 {
     //Debug.Log("Initializing dock at next node");
     _currentSession = null;
     _origin         = GameObject.Find("Origin").transform;
 }
Example #10
0
 public virtual DockRequestResult Undock(ShipBase requester, out DockSessionBase session)
 {
     session = null;
     return(DockRequestResult.Deny);
 }
Example #11
0
 public override BTResult Exit(BTResult result)
 {
     _undockSession = null;
     return(result);
 }
Example #12
0
 public override void Initialize()
 {
     _undockSession = null;
 }