コード例 #1
0
        public PhysicsManager(Main game, bool bEnableDebugDrawer)
            : base(game)
        {
            this.game = game;
            this.bEnableDebugDrawer = bEnableDebugDrawer;
            this.physicSystem = new PhysicsSystem();

            //add cd/cr system
            this.physicSystem.CollisionSystem = new CollisionSystemSAP();
            this.physicSystem.EnableFreezing = true;
            this.physicSystem.SolverType = PhysicsSystem.Solver.Normal;
            this.physicSystem.CollisionSystem.UseSweepTests = true;
            //affect accuracy and the overhead == time required
            this.physicSystem.NumCollisionIterations = 8; //8
            this.physicSystem.NumContactIterations = 8; //8
            this.physicSystem.NumPenetrationRelaxtionTimesteps = 12; //15

            #region SETTING_COLLISION_ACCURACY
            //affect accuracy of the collision detection
            this.physicSystem.AllowedPenetration = 0.000025f;
            this.physicSystem.CollisionTollerance = 0.00005f;
            #endregion

            this.physCont = new PhysicsController();
            this.physicSystem.AddController(physCont);

            if (bEnableDebugDrawer)
            {
                this.physicsDebugDrawer = new PhysicsDebugDrawer(game);
                game.Components.Add(this.physicsDebugDrawer);
            }
        }
コード例 #2
0
 public PhysicsDebugDrawer(Main game)
     : base(game)
 {
     this.game = game;
     this.vertexData = new List<VertexPositionColor>();
     this.basicEffect = new BasicEffect(game.GraphicsDevice);
 }
 public CharacterRotatorInteractionController(Main game, string name, Actor parentActor, Actor targetActor, bool bEnabled)
     : base(name, parentActor, bEnabled)
 {
     this.game = game;
     this.targetActor = targetActor;
     this.isRotating = false;
 }
コード例 #4
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Main game = new Main())
     {
         game.Run();
     }
 }
コード例 #5
0
        public CameraManager(Main game)
            : base(game)
        {
            this.cameraDictionary = new Dictionary<string, List<Camera3D>>();

            game.EventDispatcher.RotationStarted += HandleRotationStarted;
            game.EventDispatcher.RotationEnd += HandleRotationEnd;
            game.EventDispatcher.CameraChange += HandleCameraChanged;
        }
コード例 #6
0
 //See http://rbwhitaker.wikidot.com/audio-tutorials
 //See http://msdn.microsoft.com/en-us/library/ff827590.aspx
 //See http://msdn.microsoft.com/en-us/library/dd940200.aspx
 public SoundManager(Main game, string audioEngineStr, string waveBankStr, string soundBankStr)
     : base(game)
 {
     this.game = game;
     this.audioEngine = new AudioEngine(@"" + audioEngineStr);
     this.waveBank = new WaveBank(audioEngine, @"" + waveBankStr);
     this.soundBank = new SoundBank(audioEngine, @"" + soundBankStr);
     this.cueList = new List<Cue3D>();
     this.playSet = new HashSet<string>();
     this.audioListener = new AudioListener();
 }
コード例 #7
0
        public TexturedQuad(Main game,
            Texture2D texture, BasicEffect effect, RasterizerState rasterizerState,
            Vector3 translation, Vector3 rotation, Vector3 scale, Color color)
            : base(game)
        {
            this.game = game;
            this.effect = effect;
            this.texture = texture;
            this.rasterizerState = rasterizerState;
            this.color = color;

            this.world = Matrix.Identity
                * Matrix.CreateScale(scale)
                    * Matrix.CreateRotationX(rotation.X)
                        * Matrix.CreateRotationY(rotation.Y)
                            * Matrix.CreateRotationZ(rotation.Z)
                                * Matrix.CreateTranslation(translation);
        }
コード例 #8
0
        public MenuManager(Main game, Texture2D[] menuTextures, 
            SpriteFont menuFont, Integer2 textureBorderPadding,
            Color menuTextureBlendColor)
            : base(game)
        {
            this.game = game;

            //load the textures
            this.menuTextures = menuTextures;

            //background blend color for the menu
            this.menuTextureBlendColor = menuTextureBlendColor;

            //menu font
            this.menuFont = menuFont;

            //stores all menu item (e.g. Save, Resume, Exit) objects
            this.menuItemList = new List<MenuItem>();

            //set the texture background to occupy the entire screen dimension, less any padding
            this.textureRectangle = game.ScreenRectangle;

            //deflate the texture rectangle by the padding required
            this.textureRectangle.Inflate(-textureBorderPadding.X, -textureBorderPadding.Y);

            this.menuState = MenuData.MenuStateMain;

            this.numberBarsMusicMax = 6;
            this.numberBarsSFXMax = 6;
            this.numberBarsMusic = 3;
            this.numberBarsSFX = 3;

            this.volumeMusic = numberBarsMusic/(float)numberBarsMusicMax;
            this.volumeSFX = numberBarsSFX/(float)numberBarsSFXMax;

            this.muted = false;

            game.SoundManager.SetVolume(volumeMusic, "Music");
            game.SoundManager.SetVolume(volumeSFX, "SFX");

            //show the menu
            ShowMenu();
        }
コード例 #9
0
 public EventDispatcher(Main game, int initialSize)
     : base(game)
 {
     stack = new Stack<EventData>(initialSize);
     uniqueSet = new HashSet<EventData>(new EventDataEqualityComparer());
 }
コード例 #10
0
ファイル: MouseManager.cs プロジェクト: TaraMG/TeamCyberDyne
 public MouseManager(Main game, bool isVisible)
     : base(game)
 {
     this.game = game;
     game.IsMouseVisible = isVisible;
 }
コード例 #11
0
ファイル: CameraManager.cs プロジェクト: TaraMG/TeamCyberDyne
 public CameraManager(Main game)
     : base(game)
 {
     this.cameraDictionary =
         new Dictionary<CameraLayout, List<Camera3D>>();
 }
コード例 #12
0
ファイル: ObjectManager.cs プロジェクト: TaraMG/TeamCyberDyne
 public ObjectManager(Main game, int initialDrawSize, int initialRemoveSize)
     : base(game)
 {
     this.drawList = new List<DrawnActor>(initialDrawSize);
     this.removeList = new List<DrawnActor>(initialRemoveSize);
 }
コード例 #13
0
 public CharacterMoveController(Main game, string name, Actor parentActor, bool bEnabled, Camera3D camera)
     : base(name, parentActor, bEnabled)
 {
     this.game = game;
     this.camera = camera;
 }