public override void Input() { if (InputManager.Instance.Keyboard.IsKeyDown(Keys.G)) { current = 'g'; } if (InputManager.Instance.Keyboard.IsKeyDown(Keys.T)) { current = 't'; } if (InputManager.Instance.Mouse.LeftButton == ButtonState.Pressed && !InputManager.Instance.Keyboard.IsKeyDown(Keys.LeftShift) && uManager.Game.IsActive) { if (current == 't') { MeinTank x = new MeinTank(); x.addBehaviour("editBehaviour", new MeinEditBehaviour(x)); x.transform.position = new Vector2(InputManager.Instance.Mouse.X, InputManager.Instance.Mouse.Y); this.addChild(x); } if (current == 'g') { MeinGun x = new MeinGun(); x.addBehaviour("editBehaviour", new MeinEditBehaviour(x)); x.transform.position = new Vector2(InputManager.Instance.Mouse.X, InputManager.Instance.Mouse.Y); this.addChild(x); } } base.Input(); }
public override void init() { Gun = new MeinGun(); Tileset = EnvironmentX.Load("Maps/ij.txt"); me = new Tank(Tileset.getTilePosition(5, 5), uManager.CManager.Load <Texture2D>("Tank//OrangeTank"), 100, Gun); this.Attach(me.sensor); Vector2 tileIX = Tileset.PositionToTileIndex(me.transform.position.X, me.transform.position.Y); this.addChild(me); base.init(); uManager.WinHeight = 576; uManager.WinWidth = 768; }
public override void setupScene() { Random rand = new Random(System.DateTime.Now.Millisecond); Tank t; for (int i = 0; i < 5; i++) { MeinGun g = new MeinGun(); g.transform.position += new Vector2(2, 5); t = new Tank(new Vector2(rand.Next(0, 800), rand.Next(0, 600)), uManager.CManager.Load <Texture2D>("Tank//OrangeTank"), 100, g); WanderBehaviour w = new WanderBehaviour(i * 10); w.Parent = t; t.addBehaviour("wanderBehaviour", w); this.addChild(t); } }