MyGame.BulletsManager.FireShots C# (CSharp) Method

FireShots() protected method

Fire a new bullet if the specified event(C_ATTACK_BULLET_END) was received
protected FireShots ( ) : void
return void
        protected void FireShots()
        {
            foreach (Event ev in events)
            {
                switch (ev.EventId)
                {
                    case (int)MyEvent.C_ATTACK_BULLET_END:
                        Vector3 direction = Vector3.Normalize(myGame.camera.Target - myGame.camera.Position);
                        Vector3 rotation = (Vector3)ev.args["rotation"];
                        Vector3 rotatedDir = Vector3.Transform(direction, Matrix.CreateRotationY(-rotation.Y));
                    //direction.Y += 25;
                        float rotX = (float)Math.Atan2(rotatedDir.Y, rotatedDir.Z);
                        AddBullet((Vector3)ev.args["position"] + Constants.BULLET_OFFSET,
                            rotation + new Vector3(-rotX, 0, 0), direction * shotSpeed);
                        break;
                }
            }
            events.Clear();
        }