Пример #1
0
    private void OnTriggerExit(Collider _Other)
    {
        if (_Other.rigidbody != null && CNetwork.IsServer)
        {
            GameObject      actor          = _Other.rigidbody.gameObject;
            CActorBoardable boardableActor = actor.GetComponent <CActorBoardable>();
            if (boardableActor != null)
            {
                // Ensure the actor is not onboard any other facility before disembarking
                bool isWithinOtherFacility = false;
                if (actor.GetComponent <CActorLocator>() != null)
                {
                    isWithinOtherFacility = _Other.rigidbody.GetComponent <CActorLocator>().LastEnteredFacility != null;
                }
                else
                {
                    isWithinOtherFacility = CGameShips.Ship.GetComponent <CShipOnboardActors>().IsActorOnboardShip(actor);
                }

                // If not onboard within another facility, disembark the actor
                if (!isWithinOtherFacility)
                {
                    // Set the disembarking state
                    boardableActor.DisembarkActor();
                }
            }
        }
    }
Пример #2
0
 private void OnTriggerEnter(Collider _Other)
 {
     if (_Other.rigidbody != null && CNetwork.IsServer)
     {
         CActorBoardable dynamicActor = _Other.rigidbody.GetComponent <CActorBoardable>();
         if (dynamicActor != null)
         {
             dynamicActor.BoardActor();
         }
     }
 }