public void changeWeapon(PlayerWeaponName name) { if (currentWeapon.Name == name) { return; } if (currentWeapon is Shield) { switchedFromShield = true; } int currentLevel = currentWeapon.CurrentLevel; switch (name) { case PlayerWeaponName.Needle: currentWeapon = new Needle(content); break; case PlayerWeaponName.Missile: currentWeapon = new Missle(content); break; case PlayerWeaponName.Shield: currentWeapon = new Shield(content, new Vector3(position.X - 400, position.Y + 300, position.Z - 12), new Vector3(position.X - 4, position.Y, position.Z + 4)); Level.Add(new Shield(content, new Vector3(position.X - 4, position.Y, position.Z + 10), new Vector3(position.X - 8, position.Y, position.Z + 10))); Level.Add(new Shield(content, new Vector3(position.X + 4, position.Y, position.Z + 10), new Vector3(position.X + 8, position.Y, position.Z + 10))); break; } currentWeapon.CurrentLevel = currentLevel; }