private void DoAtmosphereEffects(float delta) { Atmosphere atmosphere = (Atmosphere)(Body.GetTree().GetRoot().GetNode(Game.ATMOSPHERE_PATH)); if (!(atmosphere.GetGasProgress(Gas.OXYGEN) > oxygenThreshold && atmosphere.GetGasProgress(Gas.CARBON_DIOXIDE) > co2Threshold)) { Kill(); } else { atmosphere.SetGasAmt(Gas.CARBON_DIOXIDE, atmosphere.GetGasAmt(Gas.CARBON_DIOXIDE) + co2Production * delta); atmosphere.SetGasAmt(Gas.OXYGEN, atmosphere.GetGasAmt(Gas.OXYGEN) + -oxygenConsumption * delta); } }
public void Initialize(Vector2 northPole) { Vector2 empty = new Vector2(); foreach (KeyValuePair <Player.Stats, Color> kvPair in STAT_BAR_COLORS) { Player.Stats stat = kvPair.Key; statBars[stat] = new GUIVerticalBar(empty, BAR_LENGTH, kvPair.Value, () => player[stat], () => player[stat] < STAT_LEVEL_MAX_SHOW[stat]); AddChild(statBars[stat]); Sprite sprite = STAT_BAR_SPRITES[stat](); sprite.Scale = ICON_SCALE; sprite.Position = ICON_OFFSET; statBars[stat].AddChild(sprite); } foreach (KeyValuePair <Gas, Color> kvPair in GAS_BAR_COLORS) { Gas g = kvPair.Key; gasBars[g] = new GUIHorizontalBar(empty, ATM_BAR_LENGTH, kvPair.Value, () => atm.GetGasProgress(g), () => atm.GetGasProgress(g) > 0 && atm.GetGasProgress(g) < 1); AddChild(gasBars[g]); } // debugSheet = new GUIBox(empty, COMPASS_SIZE); // AddChild(debugSheet); compass = new GUICompass(empty, COMPASS_SIZE, northPole, () => new Vector2(player.Translation.x, player.Translation.z) / Block.SIZE, viewDirSupplier, () => (player.Translation / Block.SIZE - northMonopole).LengthSquared() >= MIN_RADIUS_FOR_COMPASS * MIN_RADIUS_FOR_COMPASS); AddChild(compass); // hacky, works for now, TODO: fix inHandLabel = new GUILabel(() => { bool showLabel = !BackgroundMode && player.ItemInHand != null; if (showLabel) { inHandLabel.Text = "Currently in hand: " + player.ItemInHand.Item.Name + ", Quantity : " + player.ItemInHand.Count; } return(showLabel); }); AddChild(inHandLabel); Texture tex = Game.guiResourceLoader.GetResource(CROSSHAIR_TEX) as Texture; crosshair = new GUIObject(empty, tex.GetSize(), tex, () => !BackgroundMode); AddChild(crosshair); Visible = true; }