Exemple #1
0
        public ShootingTarget(Vector3 position, Vector3 rotation, ShootingTargetType type,
                              SoundEffect shotSFX, SoundEffect knockdownSFX)
        {
            isActive   = true;
            targetType = type;

            this.shotSFX      = shotSFX;
            this.knockdownSFX = knockdownSFX;
            sfxVolume         = 0.75f;

            slidingDirection  = new Vector3(maxMovement, 0.0f, 0.0f);
            shiftingDirection = new Vector3(0.0f, 0.0f, maxMovement);

            initialPosition  = position;
            initialRotation  = rotation;
            animationSpeed   = 3.0f;
            runFallAnimation = false;

            // Skew starting time for randomized animations
            totalTime = (float)rand.NextDouble() * 10.0f;

            // Load the target mesh
            targetMesh                = MeshManager.LoadMesh("target.m3d");
            targetMesh.Position       = position;
            targetMesh.RotationAngles = rotation;
            targetMesh.Scale          = 3.0f;
        }
Exemple #2
0
 public static void LoadModels()
 {
     ZeroMeshHandle  = MeshManager.LoadMesh(@"Models\Numbers\Zero.obj", new Vector3(0.5f));
     OneMeshHandle   = MeshManager.LoadMesh(@"Models\Numbers\One.obj", new Vector3(0.5f));
     TwoMeshHandle   = MeshManager.LoadMesh(@"Models\Numbers\Two.obj", new Vector3(0.5f));
     ThreeMeshHandle = MeshManager.LoadMesh(@"Models\Numbers\Three.obj", new Vector3(0.5f));
     FourMeshHandle  = MeshManager.LoadMesh(@"Models\Numbers\Four.obj", new Vector3(0.5f));
     FiveMeshHandle  = MeshManager.LoadMesh(@"Models\Numbers\Five.obj", new Vector3(0.5f));
     SixMeshHandle   = MeshManager.LoadMesh(@"Models\Numbers\Six.obj", new Vector3(0.5f));
     SevenMeshHandle = MeshManager.LoadMesh(@"Models\Numbers\Seven.obj", new Vector3(0.5f));
     EightMeshHandle = MeshManager.LoadMesh(@"Models\Numbers\Eight.obj", new Vector3(0.5f));
     NineMeshHandle  = MeshManager.LoadMesh(@"Models\Numbers\Nine.obj", new Vector3(0.5f));
 }
Exemple #3
0
        public Gun(GraphicsDevice device, ContentManager content, MeshRenderer meshRenderer,
                   BillboardRenderer billboardRenderer, string gunFileName)
        {
            this.device            = device;
            this.meshRenderer      = meshRenderer;
            this.billboardRenderer = billboardRenderer;

            LoadGunFromFile(gunFileName);

            currentAmmo = maxAmmo;
            isShooting  = false;
            isReloading = false;

            runAnimation        = false;
            endAnimation        = false;
            shootAnimationAngle = 0.0f;

            reloadDelta = 0.0f;
            runReload   = false;
            endReload   = false;

            adsDelta         = 0.0f;
            aimingDownSights = false;

            increaseIdolX = true;
            increaseIdolY = true;

            prevNeutralPosition = Vector3.Zero;

            rand = new Random();

            // Create graphics data
            gunMesh       = MeshManager.LoadMesh(meshFileName);
            gunMesh.Scale = scale;

            bulletParticleEmitter = new ParticleEmitter(device,
                                                        Vector3.Zero,
                                                        content.Load <Texture2D>(@"Textures\Particle"),
                                                        new BulletParticleUpdater(),
                                                        billboardRenderer,
                                                        maxAmmo,
                                                        2.0f);

            muzzleFlashBillboard = new Billboard(device,
                                                 Vector3.Zero,
                                                 Vector2.One,
                                                 content.Load <Texture2D>(@"Textures\muzzleFlash"));

            // Load crosshair textures
            crosshairRight  = content.Load <Texture2D>(@"Textures\crosshair_right");
            crosshairLeft   = content.Load <Texture2D>(@"Textures\crosshair_left");
            crosshairTop    = content.Load <Texture2D>(@"Textures\crosshair_top");
            crosshairBottom = content.Load <Texture2D>(@"Textures\crosshair_bottom");

            shootSFX = content.Load <SoundEffect>(@"SoundEffects\" + SFXFileName);

            reloadSFX               = content.Load <SoundEffect>(@"SoundEffects\" + "gun_reload");
            reloadSFXInstance       = reloadSFX.CreateInstance();
            reloadSFXInstance.Pitch = 0.5f;

            outOfAmmoSFX         = content.Load <SoundEffect>(@"SoundEffects\" + "gun_dryfire");
            outOfAmmoSFXInstance = outOfAmmoSFX.CreateInstance();
        }