public void Throw_Pickup_Weapon()
    {
        if (playerStats.currentWeapon.WeaponType != Weapon.Type.Unarmed)         // Throw weapon
        {
            EffectSpawner.instance.SpawnAnchoredGroundEffect(3, rigidBody, entityInput.GetPointerDirection(), 0.5f, 0.5f).ScaleEffect(3f);
            SoundMaker.i.PlaySound("TinySwing", transform.position, 0.5f);

            GameObject weaponPrefab = Instantiate(throwablePrefab, transform.position, Quaternion.Euler(Vector3.zero));
            //WorldSkewer.SkewObject(weaponPrefab, false);
            ThrownWeapon thrownWeapon = weaponPrefab.GetComponent <ThrownWeapon>();
            thrownWeapon.SetWeapon(playerStats.currentWeapon);
            thrownWeapon.ScaleAttack(2.25f);
            thrownWeapon.SetTrajectory(entityInput.GetPointerDirection(), 18f, 0.6f, 0.5f);

            //Discard Weapon
            playerStats.DiscardWeapon();
        }
        else         // Pick up weapon
        {
            GameObject nearestWeapon = GetNearestWeapon();
            if (nearestWeapon != null)
            {
                SoundMaker.i.PlaySound("TinySwing", transform.position, 0.5f);
                playerStats.currentWeapon = nearestWeapon.GetComponent <IDroppedWeapon>().GetWeapon();
                nearestWeapon.GetComponent <IDroppedWeapon>().DestroySelf();
            }
        }
        SpriteEquip();
        if (weaponAnimator.gameObject.activeSelf)
        {
            weaponAnimator.Play(GetStateName());
        }
        UpdateWeaponAnimator();
    }
    public void DropWeapon()
    {
        if (playerStats.currentWeapon.WeaponType != Weapon.Type.Unarmed)         // Throw weapon
        {
            //EffectSpawner.instance.SpawnAnchoredGroundEffect(3, rigidBody, entityInput.GetPointerDirection(), 0.5f, 0.5f).ScaleEffect(3f);
            SoundMaker.i.PlaySound("TinySwing", transform.position, 0.5f);

            GameObject weaponPrefab = Instantiate(throwablePrefab, transform.position, Quaternion.Euler(Vector3.zero));
            //WorldSkewer.SkewObject(weaponPrefab, false);
            ThrownWeapon thrownWeapon = weaponPrefab.GetComponent <ThrownWeapon>();
            thrownWeapon.SetWeapon(playerStats.currentWeapon);
            thrownWeapon.ScaleAttack(2.25f);
            thrownWeapon.SetTrajectory(entityInput.GetPointerDirection(), 4f, 0.6f, 0.5f);

            //Discard Weapon
            playerStats.DiscardWeapon();
        }
        SpriteEquip();
        UpdateWeaponAnimator();
    }
示例#3
0
 public ThrowEvent(ThrownWeapon thrownWeapon, BaseEntity.RPCMessage msg)
 {
     Projectile = thrownWeapon;
     Player = Server.GetPlayer(msg.player);
     ProjectileName = ExplosiveNames[thrownWeapon.ShortPrefabName];
 }
示例#4
0
        /// <summary>
        /// Called from <c>ThrownWeapon.DoThrow(BaseEntity.RPCMessage)</c> .
        /// </summary>
        public static void On_PlayerThrowExplosive(ThrownWeapon thrownWeapon, BaseEntity.RPCMessage msg)
        {
            ThrowEvent evt = new ThrowEvent(thrownWeapon, msg);

            switch (evt.ProjectileName)
            {
                case "F1 Grenade":
                case "Beancan Grenade":
                    OnNext("On_PlayerThrowGrenade", evt);
                    break;

                case "Timed Explosive Charge":
                case "Survey Charge":
                case "Satchel Charge":
                    OnNext("On_PlayerThrowCharge", evt);
                    break;

                case "Supply Signal":
                    OnNext("On_PlayerThrowSignal", evt);
                    break;
            }
        }
示例#5
0
 public WeaponThrowEvent(ThrownWeapon thrownWeapon, BaseEntity.RPCMessage msg)
 {
     _msg          = msg;
     _thrownWeapon = thrownWeapon;
     _player       = Server.GetPlayer(msg.player);
 }
示例#6
0
文件: Hooks.cs 项目: Viproz/Pluton
 public static void DoThrow(ThrownWeapon thrownWeapon, BaseEntity.RPCMessage msg)
 {
     OnWeaponThrow.OnNext(new WeaponThrowEvent(thrownWeapon, msg));
 }
示例#7
0
文件: Hooks.cs 项目: Notulp/Pluton
 public static void On_WeaponThrow(ThrownWeapon thrownWeapon, BaseEntity.RPCMessage msg)
 {
     OnNext("On_WeaponThrow", new WeaponThrowEvent(thrownWeapon, msg));
 }
示例#8
0
 public WeaponThrowEvent(ThrownWeapon thrownWeapon, BaseEntity.RPCMessage msg)
 {
     _msg = msg;
     _thrownWeapon = thrownWeapon;
     _player = Server.GetPlayer(msg.player);
 }
示例#9
0
 public static void On_WeaponThrow(ThrownWeapon thrownWeapon, BaseEntity.RPCMessage msg)
 {
     OnNext("On_WeaponThrow", new WeaponThrowEvent(thrownWeapon, msg));
 }