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(); }