static ModelManager() { int i = 0; modelBank = new List<ManagedModel>(); OBJModel model; UnlockedModels = 1; //first model model = new OBJModel("data/models/apple/apple.obj"); model.Stroke = false; model.ScaleFactor = 0.03f; model.CalculateReach(); modelBank.Add(new ModelManager.ManagedModel(1f, model, Properties.Settings.Default.unlockStatus[i++], "Apple", "", 20)); //second model model = new OBJModel("data/models/cake/pie.obj"); model.ScaleFactor = 0.003f; model.Stroke = false; model.ApplyOriginalObjectColor = true; model.CalculateReach(); modelBank.Add(new ModelManager.ManagedModel(.3f, model, Properties.Settings.Default.unlockStatus[i++], "The cake is a lie", "You have unlocked a pie!.\n" + "Congrats. Now you can\n" + "explode more than apples!\n" + "Go on, explode it.\n" + "Now, mate!", 50)); if (Properties.Settings.Default.unlockStatus[i - 1] == true) { modelBank[0].rarity -= modelBank[i - 1].rarity; UnlockedModels++; } //third model model = new OBJModel("data/models/banana/banana.obj"); model.ScaleFactor = 0.04f; model.Stroke = false; model.ApplyOriginalObjectColor = true; model.CalculateReach(); modelBank.Add(new ModelManager.ManagedModel(.3f, model, Properties.Settings.Default.unlockStatus[i++], "A banana", "You have unlocked a banana!.\n" + "Congrats. Now you can\n" + "explode more than cakes!\n" + "Go on, explode it.\n" + "Now, mate!", 50)); if (Properties.Settings.Default.unlockStatus[i - 1] == true) { modelBank[0].rarity -= modelBank[i - 1].rarity; UnlockedModels++; } }
public ManagedModel(float rarity, OBJModel model, bool unlocked, string name, string unlockMessage, int score) { this.rarity = rarity; this.model = model; this.unlocked = unlocked; this.name = name; this.unlockMessage = unlockMessage; this.score = score; }
/// <summary> /// Initializes this class along with all the buttons and models. /// In general, this is a fairly slow process. /// </summary> /// <param name="parent">The parent of this control.</param> public IntroScene(GameWindow parent) { Parent = parent; arrow = new Object(); gun = new Object(); var temp = new OBJModel(); temp.Color = Color.LightGoldenrodYellow; temp.ParseOBJFile("data/models/arrow/arrow.obj"); temp.ScaleFactor = 1.5f; temp.Stroke = true; temp.Rotate = false; temp.RotationVector = new Vector(1.0f, 0.0f, 0.0f); arrow.Body = temp; arrow.Visible = false; arrow.Location = new Vector(-1.5f, -11.3f); temp = new OBJModel(); temp.ParseOBJFile("data/models/gun/gun.obj"); temp.ScaleFactor = 0.2f; temp.Rotate = true; temp.RotationVector = new Vector(0.0f, 0.0f, 1.0f); gun.Body = temp; gun.Visible = false; gun.Location = new Vector(9.5f, -5.3f, 3.0f); textControl = new Label(); textControl.Location = new Vector(20, 100); textControl.Text = ""; textControl.IgnoreSize = true; parent.Children.Add(textControl); timer = new Timer(); timer.Interval = 50; timer.Tick += (o, e) => { if (fadeOut < destFade) { fadeOut += 0.01f; return; } if (counter >= introText.Length) return; textControl.Text = textControl.Text + introText[counter++].ToString(); if (counter > 20 && introText[counter - 1] == '!') { arrow.Visible = true; gun.Visible = true; } }; skip = new Button(); skip.Text = "Skip/Continue"; skip.Location = new Vector(300, 500); skip.MouseClick += (pos) => { End(); Parent.State = Window.WindowState.Game; }; Parent.Children.Add(skip); Parent.Children3D.Add(this); Visible = false; skip.Visible = false; }
/// <summary> /// Initializes an instance of this class, along with the values for /// using it. /// </summary> /// <param name="parent"></param> /// <param name="model"></param> /// <param name="blurStackSize"></param> public FlyingObject(GameWindow parent, OBJModel model, int blurStackSize) { Parent = parent; Lifespan = 50; //blur BlurStackSize = blurStackSize; BlurStack = new LinkedList<Vector>(); EnableMotionBlur = true; alphaStep = .5f / BlurStackSize; PhysicalBody = new PhysicsObject(); PhysicalBody.ParentObject = this; PhysicalBody.Velocity = new Vector(GeneralMath.RandomFloat(-0.7f, 0.7f), GeneralMath.RandomFloat(1.5f, 2.5f), GeneralMath.RandomFloat(-0.5f, 0.5f)); angleIncrement = GeneralMath.RandomFloat(5.5f, 6.5f); Body = model; Location = new Vector(0.0f, 0.0f, 0.0f); MainTimer = new Timer(); MainTimer.Interval = 10; MainTimer.Tick += AnimationStep; }