Russian roulette now ends after a player dies. Still need to let the minigame manager know and add logic for moving to the next game, cleanup, ending a round, etc

This commit is contained in:
gamer147
2023-08-02 23:04:51 -04:00
parent 0d6df93904
commit bdb25fd3ce
8 changed files with 186 additions and 22 deletions

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using LuckerGame.Entities.Weapons;
using Sandbox;
namespace LuckerGame.Minigames.RussianRoulette;
public partial class RussianPistol : Weapon
{
public override string ModelPath => "weapons/rust_pistol/rust_pistol.vmdl";
public override string ViewModelPath => "weapons/rust_pistol/v_rust_pistol.vmdl";
public override string WeaponName => "Russian Pistol";
protected override List<string> HitTags => new List<string> { "victim" };
public override CitizenAnimationHelper.HoldTypes HoldType => CitizenAnimationHelper.HoldTypes.Pistol;
public override int MaxAmmo => 6;
protected override float Damage => 1000f;
[ClientRpc]
protected virtual void ShootEffects()
{
Game.AssertClient();
Particles.Create( "particles/pistol_muzzleflash.vpcf", EffectEntity, "muzzle" );
Pawn.SetAnimParameter( "b_attack", true );
ViewModelEntity?.SetAnimParameter( "fire", true );
}
public override void PrimaryAttack()
{
if ( Random.Shared.Next( 1, Ammo + 1 ) == 1)
{
ShootEffects();
Pawn.PlaySound( "rust_pistol.shoot" );
ShootBullet( 0.01f, 100, Damage, 10 );
}
else
{
Pawn.PlaySound( "denyundo" );
}
Ammo--;
}
protected override void Animate()
{
Pawn.SetAnimParameter( "holdtype", (int)CitizenAnimationHelper.HoldTypes.Pistol );
}
}