void StartGame(string songName) { SongManager.FindSongs(); SongManager.LoadSong(SongManager.Songs[4]); SongManager.CurrentSong.Play(); CreateCentralPolygon(); testPoly = CreatePolygon(new Vector2(100.0f, WindowHeight / 2.0f), Vector2.Zero, 100.0f, 5, 3.0f, Color.Red); }
void ShardPolygonOffScreen(Polygon poly) { poly.ListenMouseOn = false; float sizeMp = poly.Radius / (SPMaxRadius * (1 / Difficulty)); float skillLoss = SPMinSkill + (SPMaxSkill - SPMinSkill) * (1 - sizeMp) * Difficulty; Skill -= skillLoss; Layer.Remove(poly); }
void ShardPolygonClicked(Polygon poly) { poly.ListenMouseOn = false; float sizeMp = poly.Radius / (SPMaxRadius * (1 / Difficulty)); // mitä pienempi pg, sitä pienempi float skillGain = SPMinSkill + (SPMaxSkill - SPMinSkill) * (1 - sizeMp) * (1 / Difficulty); // pienempi pg antaa enemmän skilliä, difficulty vähentää skillgainia Skill += skillGain; poly.ClearUpdateListeners(); poly.EdgeColor = Color.White; poly.Updated += delegate { poly.Radius += SPClickEffectSpeed; poly.EdgeColor = new Color(poly.EdgeColor.R - SPClickEffectSpeed, poly.EdgeColor.G - SPClickEffectSpeed, poly.EdgeColor.B - SPClickEffectSpeed); if (poly.EdgeColor.R == 0) { Layer.Remove(poly); } }; }
Polygon CreatePolygon(Vector2 position, Vector2 velocity, float radius, int edgeCount, float edgeThickness, Color color, int layer = 0) { Polygon poly = new Polygon(position, edgeCount, radius, edgeThickness, color); poly.Velocity = velocity; Layer.AddToDraw(poly, layer); Layer.AddToUpdate(poly); return poly; }
void CreateCentralPolygon() { CentralPolygon = new Polygon(WindowCenter, 6, 50.0f, 5.0f, Color.CornflowerBlue); Layer.AddToDraw(CentralPolygon); Layer.AddToUpdate(CentralPolygon); CentralPolygon.Updated += UpdateCentralPolygon; CPMaxRadius = (WindowHeight / 2.0f) * 0.8f; SPMaxRadius = CPMaxRadius * 0.25f; skillChanged = true; }
/// <summary> /// Onko monikulmio kokonaan poissa ruudulta. /// </summary> /// <param name="poly"></param> /// <returns></returns> bool CheckForOffScreen(Polygon poly) { if ((poly.Position.X + poly.Radius + poly.EdgeThickness / 2) < 0) return true; if ((poly.Position.X - poly.Radius - poly.EdgeThickness / 2) > WindowWidth) return true; if ((poly.Position.Y + poly.Radius + poly.EdgeThickness / 2) < 0) return true; if ((poly.Position.Y - poly.Radius - poly.EdgeThickness / 2) > WindowHeight) return true; return false; }