static Game() { window = new Window(1280, 720, "Missile Command", PixelFormat.RGB); window.CursorVisible = false; Utils.window = window; cloud = new Cloud(); cannon1 = new Cannon(50, 670); cannon2 = new Cannon(window.width * 0.5f, 670); cannon3 = new Cannon(window.width - 50, 670); crosshair = new Crosshair(); background = new Sprite("Assets/Background.png"); GameOverScreen = new Sprite("Assets/GameOver.png"); Cloud = new Sprite("Assets/Cloud.png"); SpawnTime = 5f; isPresses1 = false; isPresses2 = false; isPresses3 = false; }
//Questo metodo prende un missile libero, lo attiva e gli da una traiettoria //This method graba a free missile , actived and give a path to it public bool Charge(Crosshair crosshair) { Missile m = MissileManager.GetFreeMissile(); if (m != null) { m.Position.x = position.x; m.Position.y = position.y; m.FinalPosition.x = crosshair.position.x; m.FinalPosition.y = crosshair.position.y; m.Direction = new Vector2(m.FinalPosition.x - m.Position.x, m.FinalPosition.y - m.Position.y); m.MaxMagnitude = m.Direction.magnitude(); m.Direction.Normalize(); m.ExplosionSize = 0; m.isActive = true; m.status = Missile.MissileStatus.FLYING; return(true); } return(false); }