public Tutorial(GameWindow parent) { Parent = parent; explosion.Scale = 0.5f; InfoBox welcomeBox = new InfoBox(Parent, new Vector(200, 200), Messages[0]); welcomeBox.Show(); welcomeBox.OKClicked += (pos) => { Initialize(); }; }
private void AnimationStep(object sender, EventArgs evArgs) { if (Math.Abs(-(float)Camera.Location.Z - fObject.Location.Z) <= 10 + (float)GameConstants.ZoomErrorMargin && !firstTimeout) { Camera.RotateAround(new DecimalVector((decimal)fObject.Location.X, 0m, (decimal)fObject.Location.Z)); firstTimeout = true; } currentTime++; if (currentTime == firstMessageTimeout) { fObject.Paused = true; var intro = new InfoBox(Parent, new Vector(200, 200), Messages[1]); intro.OKClicked += (pos) => { Camera.StopRotation(); Camera.MoveTo(new DecimalVector(0m, 0m, 50m), 40); Camera.LookAt(new DecimalVector(0m, 0m, 0m), 40); timer.Tick += ExplodeObject; }; intro.Show(); } }
private void ExplodeObject(object sender, EventArgs evArgs) { if (!Parent.MouseClicked) return; Object pick = Picking.RayCastPick(Parent, fObject); if (pick != fObject) return; Parent.Children3D.Add(explosion); explosion.Location = fObject.Location; explosion.Explode(); timer.Stop(); timer.Dispose(); Parent.Children3D.Remove(fObject); var info = new InfoBox(Parent, new Vector(200, 200), Messages[2]); info.Show(); info.OKClicked += (pos) => { Camera.Location.X = 0m; Camera.Location.Y = 0m; Camera.Location.Z = -50m; Game.StartNextLevel(); }; }
private static void UnlockAnimation(GameWindow parent) { var infoBox = new InfoBox(parent, new Vector(200, 200), modelBank[UnlockedModels].unlockMessage); infoBox.Size.X = 250; infoBox.CanBeMoved = false; infoBox.Show(); var obj = new Object(); obj.Body = modelBank[UnlockedModels].model; //i know it's bad practice but since our camera is //always located at one point, it doesn't matter obj.Location = new Vector(0, 0, 0); obj.Body.Rotate = true; infoBox.OKClicked += (pos) => { parent.Children3D.Remove(obj); obj.Body.Rotate = false; Game.EndLevel(); }; infoBox.ExclamationClicked += (pos) => { parent.Add3DChildren(obj); }; }
public static void UnlockModel(GameWindow parent) { if (UnlockedModels >= modelBank.Count) { if (UnlockedModels == modelBank.Count + 7) { Game.EndLevel(); return; } var infoBox = new InfoBox(parent, new Vector(400, 300), "You have unlocked all\n" + "items. Kudos... \n" + "Now you can play\n" + "forever. You will\n" + "not see this message\n" + "again."); infoBox.Show(); infoBox.OKClicked += (pos) => { Game.EndLevel(); }; UnlockedModels = modelBank.Count + 7; return; } modelBank[0].rarity -= modelBank[UnlockedModels].rarity; modelBank[UnlockedModels].unlocked = true; Settings.Default.unlockStatus[UnlockedModels] = true; Settings.Default.Save(); UnlockAnimation(parent); UnlockedModels++; }
/// <summary> /// Fails the current level. /// </summary> /// <param name="displayMessage">If true, displays a message with a restart option. Otherwise doesn't.</param> public void FailLevel(bool displayMessage = true) { HideInterface(); if (!displayMessage) return; var info = new InfoBox(Parent, new Vector(200, 200), GameplayConstants.FailLevelMessage); info.ButtonText = "Restart"; info.Show(); info.OKClicked += (pos) => Game.RestartLevel(); }