void Start() { originalPosition = transform.localPosition; audioSource = GetComponent <AudioSource>(); holographicSight = GetComponent <HolographicSight>(); laserSight = GetComponent <LaserSight>(); silencer = GetComponent <Silencer>(); bool hologramSightAttached = PlayerPrefs.GetInt("HologramSight", 0) == 1; bool laserSightAttached = PlayerPrefs.GetInt("LaserSight", 0) == 1; bool silencerAttached = PlayerPrefs.GetInt("Silencer", 0) == 1; if (hologramSightAttached) { holographicSight.Enable(); } if (laserSightAttached) { laserSight.Enable(); } if (silencerAttached) { silencer.Enable(); } }
public string GetDescription() { return($"**Mafia**: {Mafia.GetDescription()}\n" + $"**Doctor**: {Doctor.GetDescription()}\n" + $"**Detective**: {Detective.GetDescription()}\n" + $"**Silencer**: {Silencer.GetDescription()}\n" + $"**Hunter**: {Hunter.GetDescription()}\n"); }
static void Main(string[] args) { Gun aGun = new UMP45(); Gun silencedGun = new Silencer(aGun); Gun FMJsilencedGun = new FullMetalJacket(silencedGun); Gun silencedExtendedGun = new ExtendedMagazine(silencedGun); Gun extendedGun = new ExtendedMagazine(aGun); Gun FMJextendedGun = new FullMetalJacket(extendedGun); Console.WriteLine(aGun.GetInfo()); Console.WriteLine(silencedGun.GetInfo()); Console.WriteLine(FMJsilencedGun.GetInfo()); Console.WriteLine(silencedExtendedGun.GetInfo()); Console.WriteLine(extendedGun.GetInfo()); Console.WriteLine(FMJextendedGun.GetInfo()); }
static void Main(string[] args) { Weapon weapon = new BaseWeapon("This is a base weapon", 33, 50, 88); IWeaponExtension bipod = new Bipod(); IWeaponExtension holster = new Holster(); IWeaponExtension silencer = new Silencer(); weapon.RegisterExtension(bipod); weapon.RegisterExtension(holster); weapon.RegisterExtension(silencer); Console.WriteLine(weapon.GetStats()); weapon.UnregisterExtension(holster); Console.WriteLine(weapon.GetStats()); Console.WriteLine($"Turi Holster?: {weapon.HasExtension(holster)}"); Console.WriteLine($"Turi Silencer?: {weapon.HasExtension(silencer)}"); Console.ReadKey(); }
void CreateEntitySilencer(EntitiesPool pool) { var silencerComponent = new Silencer(); pool.CreateEntityAndAddComponent(silencerComponent, _countEntity); }