Exemple #1
0
 private void SendPickupGlider()
 {
     LocalPlayer.SpecialActions.SendMessage("pickupGlider");
     if (BoltNetwork.isRunning && base.entity && base.entity.isAttached && !base.entity.isOwner)
     {
         PickupGlider pickupGlider = PickupGlider.Create(GlobalTargets.Others);
         pickupGlider.targetEntity = base.entity;
         pickupGlider.Send();
     }
     else
     {
         UnityEngine.Object.Destroy(this.destroyTarget);
     }
     base.enabled = false;
 }
    private void DropGlider(bool ignoreCurrentVelocity = false)
    {
        if (!LocalPlayer.AnimControl.holdingGlider)
        {
            return;
        }
        if (LocalPlayer.AnimControl.flyingGlider)
        {
            this.StopFlyingGlider();
        }
        LocalPlayer.Animator.SetBool("hangGliderHeld", false);
        LocalPlayer.Animator.SetBool("hangGliderFlying", false);
        LocalPlayer.AnimControl.holdingGlider = false;
        LocalPlayer.AnimControl.flyingGlider  = false;
        this.gliderHeld.SetActive(false);
        LocalPlayer.Inventory.UnlockEquipmentSlot(Item.EquipmentSlot.RightHand);
        LocalPlayer.Inventory.EquipPreviousWeaponDelayed();
        Vector3 vector = LocalPlayer.Transform.position + LocalPlayer.Transform.forward * 3f;

        if (!LocalPlayer.FpCharacter.Grounded)
        {
            vector = this.gliderHeld.transform.position;
        }
        if (ignoreCurrentVelocity)
        {
            vector = LocalPlayer.Transform.position + Vector3.up * 3f;
        }
        if (BoltNetwork.isClient)
        {
            PickupGlider pickupGlider = PickupGlider.Create(GlobalTargets.OnlyServer);
            pickupGlider.dropGlider     = true;
            pickupGlider.targetEntity   = this.gliderSpawnPickup.GetComponent <BoltEntity>();
            pickupGlider.gliderId       = this.gliderSpawnPickup.GetComponent <BoltEntity>().prefabId;
            pickupGlider.dropPos        = vector;
            pickupGlider.dropRot        = this.gliderHeld.transform.rotation;
            pickupGlider.targetVelocity = LocalPlayer.Rigidbody.velocity * 100f;
            pickupGlider.Send();
        }
        else
        {
            this.SpawnDroppedGlider(vector, ignoreCurrentVelocity);
        }
        base.enabled = false;
    }