void Shoot()
    {
        if (weaponSound.isPlaying == false)
        {
            weaponSound.Play();
        }
        //Play Muzzle Flash
        muzzleFlash.SetActive(true);

        currentAmmo--;

        //Fire a Ray from the centre of the screen.
        Ray ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));

        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 100f))
        {
            Instantiate(hitmarkerPrefab, hit.point, Quaternion.LookRotation(hit.normal));  //hit.normal cuz of particle effect perpendicular to the surface.

            //check crate hit?
            //destroy crate
            crate crate = hit.transform.GetComponent <crate>();
            if (crate != null)
            {
                crate.Swap();
            }
        }
    }
        public void Update()
        {
            timer++;
            counter++;

            Camera2D.cam.Zoom = Math.Max(0.2f, 1 - (voidLine / -4000)) - .2f;

            animator.SetOrigin(new Vector2(voidLine - 220, 50));
            animator2.SetOrigin(new Vector2(voidLine - 140, 95));
            animator3.SetOrigin(new Vector2(voidLine - 50, 85));
            animator4.SetOrigin(new Vector2(voidLine - 90, 60));
            animator5.SetOrigin(new Vector2(voidLine - 86, 77));

            animator.Update();
            animator2.Update();
            animator3.Update();
            animator4.Update();
            animator5.Update();

            animator.SetAnimation(StaticStancetentacle.GetAnimation(tentacleAnimation.Idle));
            animator2.SetAnimation(StaticStancetentacle.GetAnimation(tentacleAnimation.Walk));
            animator3.SetAnimation(StaticStancetentacle.GetAnimation(tentacleAnimation.Walk2));
            animator4.SetAnimation(StaticStancetentacle.GetAnimation(tentacleAnimation.Walk));
            animator5.SetAnimation(StaticStancetentacle.GetAnimation(tentacleAnimation.Walk2));


            int mailGen  = Cloud.randCloud.Next(20000);
            int crateGen = Cloud.randCloud.Next(40000);
            int carGen   = Cloud.randCloud.Next(80000);

            if ((float)(mailGen) < 80f + counter / 5f)
            {
                float   randHeight = (float)(Cloud.randCloud.Next((int)roadHeight));
                Mailbox mb         = new Mailbox(new Vector2((Cloud.screenWidth * ((1 / Camera2D.cam.Zoom)) / 2) + 200, randHeight + 100f), this);
                renderables.Add(mb);
            }
            if ((float)(crateGen) < 80f + counter / 5f)
            {
                float randHeight = (float)(Cloud.randCloud.Next((int)roadHeight));
                crate cr         = new crate(new Vector2((Cloud.screenWidth * ((1 / Camera2D.cam.Zoom)) / 2) + 200, randHeight + 100f), this);
                renderables.Add(cr);
            }
            if ((float)(carGen) < 80f + counter / 5f && timer > 600)
            {
                float randHeight = (float)(Cloud.randCloud.Next((int)roadHeight));
                //car c = new car(new Vector2((Cloud.screenWidth + (1 / Camera2D.cam.Zoom)) / 2 + 200, randHeight), this);
                car c = new car(new Vector2((Cloud.screenWidth * (1 / Camera2D.cam.Zoom)) / 2 + 200, randHeight + 100f), this);
                renderables.Add(c);
            }

            //mainbg.velocity= new Vector2(worldSpeed, 0);
            if (vanSpeedA > 0)
            {
                vanSpeedA -= 1;
            }
            else
            {
                vanSpeedA = 0;
            }
            vanSpeed       += 0.5f - vanSpeedA;
            mainbg.velocity = new Vector2(mainbg.velocity.X - (vanSpeed / 1000), mainbg.velocity.Y);
            farbg.velocity  = new Vector2(mainbg.velocity.X / 5, farbg.velocity.Y);
            midbg.velocity  = new Vector2(mainbg.velocity.X / 2, midbg.velocity.Y);
            forebg.velocity = new Vector2(mainbg.velocity.X * 2, forebg.velocity.Y);
            roadbg.velocity = new Vector2(mainbg.velocity.X * 1.25f, farbg.velocity.Y);
            worldSpeed      = mainbg.velocity.X;
            edgeLine       -= vanSpeed;
            voidLine       -= vanSpeed;
            //voidbg.position = new Vector2(voidLine, voidbg.position.Y);

            oscillator = (oscillator + 1.0f) % ((float)Math.PI * 2.0f);

            if (voidLine + 360 > -1080 && !isDead)
            {
                float amt = Math.Min(1 - ((voidLine + 360) / -1080), 1);
                Camera2D.cam.rumble = amt * 10;
                if (amt > 0.3)
                {
                    Cloud.controller.Rumble(
                        amt /* * (((float)Math.Sin(oscillator) + 1) / 2.0f)*/,
                        amt /* * (((float)Math.Sin(oscillator) + 1) / 2.0f)*/,
                        1);
                }
            }

            if (particleTimer <= 0)
            {
                CloudParticle p1 = new CloudParticle(1, new Vector2(edgeLine + 60, 230 + Cloud.randCloud.Next(40) - 20), 0.999f, this);
                CloudParticle p2 = new CloudParticle(2, new Vector2(edgeLine + 60, 150 + Cloud.randCloud.Next(40) - 20), 0.92f, this);
                CloudParticle p3 = new CloudParticle(3, new Vector2(edgeLine + 60, 80 + Cloud.randCloud.Next(40) - 20), 0.7f, this);
                CloudParticle p4 = new CloudParticle(4, new Vector2(edgeLine + 60, -20 + Cloud.randCloud.Next(40) - 20), 0.6f, this);
                //CloudParticle p5 = new CloudParticle(5, new Vector2(edgeLine + 60, 100 + Cloud.randCloud.Next(200) - 100), 0.91f, this);
                renderables.Add(p1);
                renderables.Add(p2);
                renderables.Add(p3);
                renderables.Add(p4);
                //renderables.Add(p5);
                particleTimer = 12 + Cloud.randCloud.Next(10) - 5;
            }
            else
            {
                particleTimer--;
            }
            foreach (Renderable r in renderables)
            {
                if (r is Actor)
                {
                    (r as Actor).Update();
                }
            }

            foreach (Renderable r in toAdd)
            {
                renderables.Add(r);
            }
            toAdd.Clear();

            foreach (Renderable r in toRemove)
            {
                r.Unload();
                renderables.Remove(r);
            }
            toRemove.Clear();
        }