Пример #1
0
    public void Dock( DockingBay.DockingSlot _slot )
    {
        if ( state == FIGHTERSTATE.UNDOCKING )
        {
            DebugConsole.Log( "Skipping dock", this );
            return;
        }

        DebugConsole.Log( "Proceeding with dock", this );

        this.movement.desiredSpeed = 0;
        this.GetComponent<Rigidbody>().velocity = Vector3.zero;
        this.GetComponent<Rigidbody>().angularVelocity = Vector3.zero;
        this.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
        this.transform.position = _slot.landedPosition.position;
        this.transform.rotation = _slot.landedPosition.rotation;

        this.currentSlot = _slot;
        this.state = FIGHTERSTATE.DOCKED;
        this.transform.parent = _slot.landedPosition;

        if ( Network.peerType != NetworkPeerType.Disconnected )
        {
            GameNetworkManager.instance.SendDockedMessage( this.GetComponent<NetworkView>().viewID, this.health.Owner.team, _slot.slotID );
        }
    }
Пример #2
0
    public void Undock()
    {
        this.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.None;
        this.GetComponent<Rigidbody>().angularVelocity = Vector3.zero;

        this.state = FIGHTERSTATE.UNDOCKING;
        this.currentSlot.landedFighter = null;

        this.transform.parent = null;

        PlayerUpgrader.instance.UpdateLevels (GamePlayerManager.instance.GetPlayerWithID( this.health.Owner.id ) );

        if ( Network.peerType != NetworkPeerType.Disconnected )
        {
            GameNetworkManager.instance.SendUndockedMessage( this.GetComponent<NetworkView>().viewID, this.health.Owner.team, this.currentSlot.slotID );
        }
        this.currentSlot = null;
    }