public static RobotProxy SpawnPlayableRobot(ShooterEngine engine) { var model = new RobotModel(); model.TurretRotation = (float)(random.NextDouble() * Math.PI * 2); var view = new RobotView(engine, model); var body = BodyFactory.CreateCircle(engine.World, 0.5f, 1f); body.BodyType = BodyType.Dynamic; body.LinearDamping = 2f; body.AngularDamping = 2f; body.Rotation = (float)(random.NextDouble() * Math.PI * 2); Texture2D lightTexture; if(RobotFactory.LightTexture == null) { RobotFactory.LightTexture = Krypton.Factories.TextureFactory.CreatePoint(engine.GraphicsDevice, 32); //RobotFactory.LightTexture = engine.Game.Content.Load<Texture2D>("Textures/Lights/RobotHeadlight"); } var light = new PointLight(RobotFactory.LightTexture); light.Intensity = 1; light.Radius = 10f; light.Color = Color.Gray; light.Fov = MathHelper.TwoPi / 3f; light.Rotation = model.TurretRotation; light = null; var controller = new AbsoluteRobotController(engine, model, body, light); var linker = new RobotLinker(body, model, light); var proxy = new RobotProxy(engine, model, view, controller, body, linker, light); proxy.Initialize(); return proxy; }
public AbsoluteRobotController(ShooterEngine engine, RobotModel robotModel, Body body, PointLight light) { this.engine = engine; this.robotModel = robotModel; this.body = body; this.light = light; }
public ShooterGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; this.IsMouseVisible = true; this.Window.AllowUserResizing = true; engine = new ShooterEngine(this); this.Components.Add(engine); graphics.DeviceReset += (sender, args) => this.DeviceReset(); graphics.DeviceResetting += (sender, args) => this.DeviceResetting(); }
public RobotProxy(ShooterEngine engine, RobotModel model, RobotView view, AbsoluteRobotController controller, Body body, RobotLinker linker, PointLight light) { if(engine == null) { throw new ArgumentException("Engine cannot be null", "engine"); } this.Engine = engine; this.Model = model; this.View = view; this.Controller = controller; this.Body = body; this.Linker = linker; this.Light = light; }
public Tiler(ShooterEngine engine) { this.engine = engine; this.texture = engine.Game.Content.Load<Texture2D>("Textures/BackgroundTile"); }
public RobotView(ShooterEngine engine, RobotModel robotModel) { this.engine = engine; this.robotModel = robotModel; this.texture = engine.Game.Content.Load<Texture2D>("Textures/Player"); }