public Liquid(string type) { switch (type) { case "Water": _speedOFFlow = 3; _density = 1; _volume = 0; _liquidType = LiquidType.water; break; case "Oil": _speedOFFlow = 2; _density = 2; _volume = 0; _liquidType = LiquidType.oil; break; case "Mercury": _speedOFFlow = 1; _density = 3; _volume = 0; _liquidType = LiquidType.mercury; break; default: _speedOFFlow = 1; _density = 1; _volume = 0; _liquidType = LiquidType.water; Debug.Log("Shit format of liquid, bruh"); break; } }
//Made a new method for this because I felt like it :P public static void CircleOfLiquid(int x, int y, int radius, LiquidType liquidType, bool chanceEdges = true, int chanceEdgeChance = 3) { int yStart = y - radius; for (int i = x - radius; i < x + radius; i++) { for (int j = yStart; j < y + radius; j++) { float distance = Math.Abs(Vector2.Distance(new Vector2(i, j), new Vector2(x, y))); if (distance > radius - 1.1f) { if (Main.rand.Next(chanceEdgeChance) == 0) { goto Fin; } } if (distance < radius) { if (Main.tile[i, j] == null) Main.tile[i, j] = new Tile(); Main.tile[i, j].active(false); if (liquidType == LiquidType.Lava) { Main.tile[i, j].lava(true); } else { Liquid.AddWater(i, j); } Main.tile[i, j].liquid = 255; } Fin: ; } } }
void Start() { /* * Get Drink Type * Set Labels * Set Liquid Color */ pd = GetComponent <PourDetector>(); LiquidType contents = pd.liqourType; TextMeshPro[] labels = GetComponentsInChildren <TextMeshPro>(); foreach (TextMeshPro textMeshPro in labels) { textMeshPro.text = contents.ToString("G"); } Color liquidColor = LiquidColour.getLiquidColor(contents) * (1f / 255f); liquidColor.a = 1; Renderer liquidRenderer = gameObject.GetComponentInChildren <Wobble>().gameObject.GetComponent <Renderer>(); liquidRenderer.material.SetColor("_Tint", liquidColor); liquidRenderer.material.SetColor("_TopColor", liquidColor + new Color(0.1f, 0.1f, 0.1f, 1)); liquidRenderer.material.SetColor("_FoamColor", liquidColor + new Color(0.1f, 0.1f, 0.1f, 1)); var particleSystemMainModule = GetComponent <ParticleSystem>().main; particleSystemMainModule.startColor = liquidColor; position = transform.position; orientation = transform.rotation.eulerAngles; }
static Water() { _id = ItemID.Water; _name = "淡水"; _description = "淡水敘述"; _type = LiquidType.Water; }
// A 'measure' is considered 25ml, all liquid types are variants of this; including pints. public static int GetMeasure(LiquidType t) { switch (t) { default: case LiquidType.None: return(0); case LiquidType.Water: return(kWineGlass); case LiquidType.Beer: return(kPint); case LiquidType.Vodka: return(kMeasure); case LiquidType.Whiskey: return(kMeasure); case LiquidType.Cola: return(kHalfPint); case LiquidType.Lemonade: return(kHalfPint); case LiquidType.Wine: return(kWineGlass); } return(1); }
public static byte GetLiquidLevel(int x, int y, LiquidType liquidType = LiquidType.Any) { if (x < 0 || x >= Main.maxTilesX) { return(0); } if (y < 0 || y >= Main.maxTilesY) { return(0); } var tile = Main.tile[x, y]; if (tile == null || tile.liquid == 0) { return(0); } if (liquidType == LiquidType.Any) { return(tile.liquid); } if (liquidType.HasFlag(LiquidType.Water) && !tile.lava() && !tile.honey()) { return(tile.liquid); } if (liquidType.HasFlag(LiquidType.Lava) && tile.lava()) { return(tile.liquid); } if (liquidType.HasFlag(LiquidType.Honey) && tile.honey()) { return(tile.liquid); } return(0); }
public bool PipeLuquidFromTanks(LiquidType type, uint vol) { if (!CheckTanks(type, vol)) { return(false); } var requiredQuantity = vol; foreach (var tank in Tanks.Where(x => x.Type == type)) { if (requiredQuantity == 0) { break; } var inTank = tank.CurrentVolume; if (inTank >= requiredQuantity) { tank.PipeLiquidOut(requiredQuantity); requiredQuantity = 0; } else { tank.PipeLiquidOut(inTank); requiredQuantity -= inTank; } } return(requiredQuantity == 0); }
public static Color GetColourHead(LiquidType t) { switch (t) { default: return(kColour_None); case LiquidType.Water: return(kColour_WaterHead); case LiquidType.Beer: return(kColour_BeerHead); case LiquidType.Vodka: return(kColour_VodkaHead); case LiquidType.Whiskey: return(kColour_WhiskeyHead); case LiquidType.Cola: return(kColour_ColaHead); case LiquidType.Lemonade: return(kColour_LemonadeHead); case LiquidType.Wine: return(kColour_WineHead); case LiquidType.BeerHead: return(kColour_BeerHeadHead); } }
public void OnLiquidBoiled(LiquidType liquid_type) { if (!this.m_WasLiquidBoiledData.Contains(liquid_type)) { this.m_WasLiquidBoiledData.Add(liquid_type); } }
static Brine() { _id = ItemID.Brine; _name = "海水"; _description = "海水敘述"; _type = LiquidType.Water; }
public void OnDrink(LiquidType liquid_type, float hydration_amount) { using (Dictionary <int, Disease> .KeyCollection.Enumerator enumerator = this.m_Diseases.Keys.GetEnumerator()) { while (enumerator.MoveNext()) { ConsumeEffect key = (ConsumeEffect)enumerator.Current; Disease disease = this.m_Diseases[(int)key]; if (disease.IsActive()) { disease.OnDrink(liquid_type); } } } using (Dictionary <int, global::DiseaseSymptom> .KeyCollection.Enumerator enumerator2 = this.m_Symptoms.Keys.GetEnumerator()) { while (enumerator2.MoveNext()) { Enums.DiseaseSymptom key2 = (Enums.DiseaseSymptom)enumerator2.Current; global::DiseaseSymptom diseaseSymptom = this.m_Symptoms[(int)key2]; if (diseaseSymptom.IsActive()) { diseaseSymptom.OnDrink(liquid_type, hydration_amount); } } } }
public void AddLiquid(LiquidType liquidType, double volumeAdded) { if (currentVolume >= maxVolume) { return; } // if (LiquidsList != null) { for (int i = 0; i < LiquidsList.Count; i++) { if (LiquidsList[i].liquidType == liquidType) { LiquidsList[i].volume += volumeAdded; return; } } } // else // liquids is null, or liquidType is not in list { Liquid addedLiquid = new Liquid(liquidType, volumeAdded); LiquidsList.Add(addedLiquid); } }
public Liquid() { _speedOFFlow = 1; _density = 1; _volume = 1; _liquidType = LiquidType.water; }
public void CreateSplash(Vector3 pos, LiquidType liquid) { if (MathFunctions.RandEvent(0.9f)) { return; } switch (liquid) { case LiquidType.Water: { SplashType splash = new SplashType { name = "splash2", numSplashes = 2, position = pos, sound = ContentPaths.Audio.river }; Splashes.Enqueue(splash); } break; case LiquidType.Lava: { SplashType splash = new SplashType { name = "flame", numSplashes = 5, position = pos, sound = ContentPaths.Audio.fire }; Splashes.Enqueue(splash); } break; } }
public static byte GetLiquidLevel(int x, int y, LiquidType liquidType = LiquidType.Any) { if (!WorldGen.InWorld(x, y)) { return(0); } Tile tile = Main.tile[x, y]; if (tile == null) { return(0); } if (liquidType == LiquidType.Any) { return(tile.liquid); } if (liquidType.HasFlag(LiquidType.Water) && !tile.lava() && !tile.honey()) { return(tile.liquid); } if (liquidType.HasFlag(LiquidType.Lava) && tile.lava()) { return(tile.liquid); } if (liquidType.HasFlag(LiquidType.Honey) && tile.honey()) { return(tile.liquid); } return(0); }
public bool SetNotAlcholControl(int id, LiquidType liquid, SolidType solid) { ControlMarker ctrl = GetNotAlcholControl(id); if (ctrl != null) { ctrl.Liquid = liquid; ctrl.Solid = solid; ctrl.ControlUpdated(); ControlInfo info = null; switch (id) { case 0: info = Tap_Up; break; case 1: info = Tap_Right; break; case 2: info = Tap_Down; break; case 3: info = Tap_Left; break; } if (info != null) { info.Liquid = liquid; info.Solid = solid; } return(true); } return(false); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); m_AlchemyLiquidType = (LiquidType)reader.ReadEncodedInt(); }
public void HandleLiquidInteraction(VoxelHandle Vox, LiquidType From, LiquidType To) { if ((From == LiquidType.Lava && To == LiquidType.Water) || (From == LiquidType.Water && To == LiquidType.Lava)) { Vox.Type = Library.GetVoxelType("Stone"); Vox.QuickSetLiquid(LiquidType.None, 0); } }
public static String MakeUnit(int ml, int glassSizeMl, LiquidType lt) { switch (lt) { case LiquidType.Water: case LiquidType.Beer: case LiquidType.Cola: case LiquidType.Lemonade: case LiquidType.Wine: { /* * if (ml <= 6) * return "1 Tsp"; * if (ml <= 12) * return "2 Tsp"; * if (ml <= 18) * return "3 Tsp"; * if (ml <= 24) * return "4 Tsp"; */ return(String.Format("{0} ml", ml)); } break; case LiquidType.Vodka: case LiquidType.Whiskey: { if (ml <= 6) { return("1 Tsp"); } if (ml <= 12) { return("2 Tsp"); } if (ml <= 18) { return("3 Tsp"); } if (ml <= 24) { return("4 Tsp"); } if (ml <= 25 + 12) { return("1 Shot"); } if (ml <= 50 + 12) { return("2 Shots"); } return(String.Format("{0} ml", ml)); } break; } return(String.Format("{0} ml", ml)); }
public static FezUnityLiquidColorScheme GetColorScheme(this LiquidType type) { FezUnityLiquidColorScheme scheme; if (LiquidColorSchemes.TryGetValue(type, out scheme)) { return(scheme); } return(null); }
private bool validate() { ComboBoxItem selectedItem = (ComboBoxItem)liquidType_comboBox.SelectedItem; if (selectedItem == null || string.IsNullOrEmpty(selectedItem.Content.ToString())) { MessageBox.Show("请选择设置类型", "系统提示"); return(false); } IList <DataGridCellInfo> cellsList = dataGrid1.SelectedCells; if (cellsList == null || cellsList.Count == 0) { MessageBox.Show("请选择采血管区域", "系统提示"); return(false); } foreach (DataGridCellInfo cell in cellsList) { int columnIndex = CommFuntion.GetDataGridCellColumnIndex(cell); int rowIndex = CommFuntion.GetDataGridCellRowIndex(cell); if (dTable.Rows[rowIndex - 1]["type" + columnIndex] != null && dTable.Rows[rowIndex - 1]["type" + columnIndex].ToString() == "hasRecord") { MessageBox.Show("不能选择已被其他类型保存的区域", "系统提示"); return(false); } } LiquidType type = (LiquidType)selectedItem.DataContext; if (type != null) { if (!type.CanSelectedMultiCell && cellsList.Count > 1) { MessageBox.Show("不能选择多个采血管区域", "系统提示"); return(false); } if (type.HasVolume && volume_TextBox.IsVisible) { double volume_out = 0; if (string.IsNullOrEmpty(volume_TextBox.Text) || !double.TryParse(volume_TextBox.Text, out volume_out)) { MessageBox.Show("容量输入不合法,必须为数字", "系统提示"); volume_TextBox.Focus(); return(false); } } } return(true); }
Ingredient FindIngredientUi(LiquidType lt) { for (int i = 0; i < ingredients.Count; i++) { if (ingredients[i].LiquidType == lt) { return(ingredients[i]); } } return(null); }
bool IsTop(LiquidType lt) { LiquidType lastLiquidType = LiquidType.None; foreach (var l in Glass.liquids) { lastLiquidType = l.type; } return(lastLiquidType == lt); }
public LiquidPrimitive(LiquidType type) : base() { LiqType = type; faceDeltas[BoxFace.Back] = new Vector3(0, 0, 1); faceDeltas[BoxFace.Front] = new Vector3(0, 0, -1); faceDeltas[BoxFace.Left] = new Vector3(-1, 0, 0); faceDeltas[BoxFace.Right] = new Vector3(1, 0, 0); faceDeltas[BoxFace.Top] = new Vector3(0, 1, 0); faceDeltas[BoxFace.Bottom] = new Vector3(0, -1, 0); }
private void liquidType_comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem selectedItem = (ComboBoxItem)liquidType_comboBox.SelectedItem; string content = selectedItem.Content.ToString(); LiquidType type = (LiquidType)selectedItem.DataContext; dataGrid1.UnselectAllCells(); SetRecordsBackGround(); if (type != null) { txt_Control.Visibility = System.Windows.Visibility.Visible; lab_Control.Visibility = System.Windows.Visibility.Visible; txt_Control.Background = new SolidColorBrush() { Color = (Color)ColorConverter.ConvertFromString(type.Color) }; lab_Control.Content = type.TypeName; if (type.HasVolume) { volumeLabel.Visibility = Visibility.Visible; volume_TextBox.Visibility = Visibility.Visible; volume_TextBox.Text = type.DefaultVolume.ToString(); volumeUnitlabel.Visibility = Visibility.Visible; } else { volumeLabel.Visibility = Visibility.Hidden; volume_TextBox.Visibility = Visibility.Hidden; volumeUnitlabel.Visibility = Visibility.Hidden; } List <SystemFluidConfiguration> configRecords = controller.GetLiquidConfigurationByTypeId(type.TypeId); if (configRecords != null && configRecords.Count > 0) { foreach (SystemFluidConfiguration config in configRecords) { volume_TextBox.Text = config.Volume.ToString(); int columnIndex = (int)config.Grid; int rowIndex = (int)config.Position; dTable.Rows[rowIndex - 1]["type" + columnIndex] = config.ItemType.ToString(); } setButtonStatus(true); } else { setButtonStatus(false); } } }
public static bool IsWater(this LiquidType waterType) { if (waterType != LiquidType.Blood && waterType != LiquidType.Water && waterType != LiquidType.Purple) { return(waterType == LiquidType.Green); } else { return(true); } }
public LiquidData GetLiquidDataByComponents(LiquidType type, ItemID id) { foreach (LiquidData liquidData in this.m_LiquidDatas) { if (liquidData.m_LiquidComponent == type && liquidData.m_ItemComponent == id) { return(liquidData); } } return(null); }
public LiquidData GetLiquidData(LiquidType type) { foreach (LiquidData liquidData in this.m_LiquidDatas) { if (liquidData.m_LiquidType == type) { return(liquidData); } } return(null); }
public static void FillLiquid(int x, int y, int width, int height, LiquidType liquidType) { for (int i = x; i < x + width; i++) { for (int j = y; j < y + height; j++) { Main.tile[i, j].liquidType((int)liquidType); Main.tile[i, j].liquid = 255; } } }
public void Main_tile_Get_liquidType_Set(LiquidType value) { var events = Mock.Of <IEventManager>(); var log = Mock.Of <ILogger>(); using var world = new OrionWorld(events, log); Terraria.Main.tile[0, 0].liquidType((int)value); Assert.Equal(value, world[0, 0].Liquid.Type); }
public void OnDrink(LiquidType liquid_type) { if (LiquidManager.Get().GetLiquidData(liquid_type).m_ConsumeEffect == this.m_Type) { this.m_Level += LiquidManager.Get().GetLiquidData(liquid_type).m_ConsumeEffectLevel; } this.m_Level = Mathf.Clamp(this.m_Level, 0, 100); if (this.m_Level == 0) { this.Deactivate(); } }
public void Reset() { IsActive = false; WireRed = false; WireGreen = false; WireBlue = false; TileColor = 0; Type = 0; Wall = 0; LiquidType = 0; WallColor = 0; LiquidAmount = 0; BrickStyle = 0; Actuator = false; InActive = false; }
/// <summary> /// Loads and parses the provided data. /// </summary> /// <param name="data">Data.</param> public override void LoadData(byte[] data) { if (this.Version == WarcraftVersion.Unknown) { throw new InvalidOperationException("The record data cannot be loaded before SetVersion has been called."); } using (MemoryStream ms = new MemoryStream(data)) { using (BinaryReader br = new BinaryReader(ms)) { this.ID = br.ReadUInt32(); this.Name = new StringReference(br.ReadUInt32()); this.Type = (LiquidType)br.ReadInt32(); this.SpellEffect = new UInt32ForeignKey(SpellRecord.RecordName, "ID", br.ReadUInt32()); } } }
private void SetPixelAutomatic(Tile curTile, int? tile = null, int? wall = null, byte? liquid = null, LiquidType? liquidType = null, bool? wire = null, short? u = null, short? v = null, bool? wire2 = null, bool? wire3 = null, BrickStyle? brickStyle = null, bool? actuator = null, bool? actuatorInActive = null, int? tileColor = null, int? wallColor = null) { // Set Tile Data if (u != null) curTile.U = (short)u; if (v != null) curTile.V = (short)v; if (tile != null) { if (tile == -1) { curTile.Type = 0; curTile.IsActive = false; } else { curTile.Type = (ushort)tile; curTile.IsActive = true; } } if (actuator != null && curTile.IsActive) { curTile.Actuator = (bool)actuator; } if (actuatorInActive != null && curTile.IsActive) { curTile.InActive = (bool)actuatorInActive; } if (brickStyle != null && TilePicker.BrickStyleActive) { curTile.BrickStyle = (BrickStyle)brickStyle; } if (wall != null) curTile.Wall = (byte)wall; if (liquid != null) { curTile.LiquidAmount = (byte)liquid; } if (liquidType != null) { curTile.LiquidType = (LiquidType)liquidType; } if (wire != null) curTile.WireRed = (bool)wire; if (wire2 != null) curTile.WireGreen = (bool)wire2; if (wire3 != null) curTile.WireBlue = (bool)wire3; if (tileColor != null) { if (curTile.IsActive) { curTile.TileColor = (byte)tileColor; } else { curTile.TileColor = (byte)0; } } if (wallColor != null) { if (curTile.Wall != 0) { curTile.WallColor = (byte)wallColor; } else { curTile.WallColor = (byte)0; } } if (curTile.IsActive) if (World.TileProperties[curTile.Type].IsSolid) curTile.LiquidAmount = 0; }
public float GetSpreadRate(LiquidType type) { switch(type) { case LiquidType.Lava: return 0.1f + MathFunctions.Rand() * 0.1f; case LiquidType.Water: return 0.5f; } return 1.0f; }
public void CreateSplash(Vector3 pos, LiquidType liquid) { switch(liquid) { case LiquidType.Water: { SplashType splash = new SplashType { name = "splash2", numSplashes = 2, position = pos, sound = ContentPaths.Audio.river }; Splashes.Enqueue(splash); } break; case LiquidType.Lava: { SplashType splash = new SplashType { name = "flame", numSplashes = 5, position = pos, sound = ContentPaths.Audio.fire }; Splashes.Enqueue(splash); } break; } }
public void SwapLiquid() { switch (_liquidType) { case LiquidType.Lava: _liquidType = LiquidType.Honey; break; case LiquidType.Water: _liquidType = LiquidType.Lava; break; default: _liquidType = LiquidType.Water; break; } RaisePropertyChanged("LiquidType"); }