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(); }
public ThrowEvent(ThrownWeapon thrownWeapon, BaseEntity.RPCMessage msg) { Projectile = thrownWeapon; Player = Server.GetPlayer(msg.player); ProjectileName = ExplosiveNames[thrownWeapon.ShortPrefabName]; }
/// <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; } }
public WeaponThrowEvent(ThrownWeapon thrownWeapon, BaseEntity.RPCMessage msg) { _msg = msg; _thrownWeapon = thrownWeapon; _player = Server.GetPlayer(msg.player); }
public static void DoThrow(ThrownWeapon thrownWeapon, BaseEntity.RPCMessage msg) { OnWeaponThrow.OnNext(new WeaponThrowEvent(thrownWeapon, msg)); }
public static void On_WeaponThrow(ThrownWeapon thrownWeapon, BaseEntity.RPCMessage msg) { OnNext("On_WeaponThrow", new WeaponThrowEvent(thrownWeapon, msg)); }