コード例 #1
0
ファイル: Ship.cs プロジェクト: kenpower/XNA4
 public void Init()
 {
     ContentManager Content = (ContentManager)game.Services.GetService(typeof(ContentManager));
     camera = (Camera)game.Services.GetService(typeof(Camera));
     ship = Content.Load<Model>("p1_wedge");
     bulletModel = Content.Load<Model>("cone");
     timeOfLastBullet = DateTime.Now;
 }
コード例 #2
0
ファイル: Game1.cs プロジェクト: kenpower/XNA4
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            ship = new Ship(this);
            camera  = new Camera(this);

            Services.AddService(typeof(ContentManager), Content);
            Services.AddService(typeof(Camera), camera);
        }
コード例 #3
0
ファイル: Bullet.cs プロジェクト: kenpower/XNA4
 /// <summary>
 /// Allows the game component to perform any initialization it needs to before starting
 /// to run.  This is where it can query for any required services and load content.
 /// </summary>
 public void Initialize(Model m, Vector3 direction, Vector3 pos)
 {
     // TODO: Add your initialization code here
     position=pos;
     velocity=direction*maxSpeed;
     ContentManager Content = (ContentManager)theGame.Services.GetService(typeof(ContentManager));
     camera = (Camera)theGame.Services.GetService(typeof(Camera));
     bulletModel = m;
     timeOfBirth= DateTime.Now;
     alive = true;
     base.Initialize();
 }