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; }
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); }
/// <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(); }