public bool CheckFuel(Liquids carLiquids) { int fuelLevel; carLiquids.CarLiquids.TryGetValue("Fuel", out fuelLevel); return(fuelLevel > 0); }
protected Car() { CarContent = new List <CarPart>(); CarLiquids = new Liquids(); SetPartLifeTimer(); CarIsWorking = true; }
public void ReplaceFluid(Liquids fluids) { byte value; Console.WriteLine($"Petrovich: What liquid shall I replace?"); fluids.CarLiquids.TryGetValue("Fuel", out value); Console.WriteLine($"Fuel = {value}"); fluids.CarLiquids.TryGetValue("EngineOil", out value); Console.WriteLine($"EngineOil = {value}"); fluids.CarLiquids.TryGetValue("BrakeFluid", out value); Console.WriteLine($"BrakeFluid = {value}"); fluids.CarLiquids.TryGetValue("CoolingLiquid", out value); Console.WriteLine($"CoolingLiquid = {value}"); fluids.CarLiquids.TryGetValue("WindshieldWasherLiquid", out value); Console.WriteLine($"WindshieldWasherLiquid = {value}"); string key = Console.ReadLine(); if (key != null && fluids.CarLiquids.ContainsKey(key)) { Console.WriteLine($"Petrovich: Getting access to tank."); Thread.Sleep(15000); fluids.CarLiquids[key] = 100; Console.WriteLine($"Petrovich: All done!"); } else { Console.WriteLine($"No such liquid found! Please, try again:"); ReplaceFluid(fluids); } }
/* Heathtech */ public Texture GetLiquid(int num) { if (!Liquids.ContainsKey(num)) { string name = $"Images\\Liquid_{num}"; Liquids[num] = LoadTexture(name); } return(Liquids[num]); }
/* Heathtech */ public Texture GetLiquid(int num) { if (!Liquids.ContainsKey(num)) { string name = String.Format("Images\\Liquid_{0}", num); Liquids[num] = LoadTexture(name); } return(Liquids[num]); }
public override int GetHashCode() { unchecked { var hashCode = (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Liquids != null ? Liquids.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0); return(hashCode); } }
protected Car(string name) { Name = name; carLiquids = new Liquids(); Menu.PrintServiceMessage("**Please specify what parts are broken: **"); CarNames = new List <string>(); CarContent = new List <CarPart>(); CarContent.Add(body = new BodyPart()); CarContent.Add(carburetor = new CarburetorPart()); CarContent.Add(engine = new EnginePart()); CarContent.Add(gearbox = new GearboxPart()); CarContent.Add(heatregularor = new HeatRegulatorPart()); CarContent.Add(muffler = new MufflerPart()); CarContent.Add(radiator = new RadiatorPart()); CarContent.Add(wheels = new WheelsPart()); CarContent.Add(horn = new HornPart()); }
internal static bool PlaceLiquid(Player player, Liquids liquid, int range) { if (player.whoAmI == Main.myPlayer && !player.noBuilding) { Vector2 adjustedPos = player.position / 16; float xDistance = Math.Abs(Player.tileTargetX - adjustedPos.X); float yDistance = Math.Abs(Player.tileTargetY - adjustedPos.Y); if (xDistance > Player.tileRangeX + range || yDistance > Player.tileRangeY + range) { return(false); } if (PlaceLiquids(player, Player.tileTargetX, Player.tileTargetY, liquid)) { Main.PlaySound(SoundID.Splash, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); return(true); } } return(false); }
internal static bool PlaceLiquids(Player player, int x, int y, Liquids liquid) { if (Main.netMode != NetmodeID.Server) { Tile tileSafely = Framing.GetTileSafely(x, y); if (player.whoAmI == Main.myPlayer && (!tileSafely.nactive() || !Main.tileSolid[tileSafely.type] || Main.tileSolidTop[tileSafely.type])) { tileSafely.liquidType((int)liquid); tileSafely.liquid = 255; WorldGen.SquareTileFrame(x, y, true); if (Main.netMode == NetmodeID.MultiplayerClient) { NetMessage.sendWater(x, y); } else { Liquid.AddWater(x, y); } return(true); } } return(false); }
public static IEnumerable <string> RetrieveExampleList(string word) { word = word.ToLower(); if (!word.StartsWith("something")) { if (word.StartsWith("the title") || word.StartsWith("a title")) { word = word.Replace("the title ", string.Empty).Replace("a title ", string.Empty); } else { Regex firstWordRegex = new Regex(@"^\w+ "); word = firstWordRegex.Replace(word, ""); word = word.Replace("type of ", string.Empty); word = word.Replace("kind of ", string.Empty); } } switch (word) { case "noun": return(Nouns.Take(3)); case "adjective": return(Adjectives.Take(3)); case "plural noun": case "noun (plural)": return(PluralNouns.Take(3)); case "verb": return(Verbs.Take(3)); case "number": Random rand = new Random(); return(new List <string>() { rand.Next(1, 999).ToString(), rand.Next(1, 999).ToString(), rand.Next(1, 999).ToString() }); case @"verb ending in ""ing""": return(GerundVerbs.Take(3)); case "adverb": return(Adverbs.Take(3)); case "part of the body": case "body part": return(PartsOfBody.Take(3)); case "liquid": return(Liquids.Take(3)); case "place": return(Places.Take(3)); case "animal": return(Animals.Take(3)); case "food": return(Foods.Take(3)); case "color": return(Colors.Take(3)); case "verb (past tense)": return(PastTenseVerbs.Take(3)); case "celebrity": return(Celebrities.Take(3)); case "exclamation": return(Exclamations.Take(3)); case "part of the body (plural)": case "body part (plural)": return(PluralBodyParts.Take(3)); case "silly word": return(SillyWords.Take(3)); case "animal (plural)": return(PluralAnimals.Take(3)); case "city": return(Cities.Take(3)); case "nonsense word": return(NonsenseWords.Take(3)); case "famous person": return(FamousPeople.Take(3)); case "article of clothing": return(Clothing.Take(3)); case "vehicle": return(Vehicles.Take(3)); case "something alive (plural)": return(PluralAliveSomethings.Take(3)); case "geographical location": return(GeographicalLocations.Take(3)); case "town": return(Towns.Take(3)); case "country": return(Countries.Take(3)); case "container": return(Containers.Take(3)); case "last name": return(LastNames.Take(3)); case "name": return(Names.Take(3)); case @"verb ending in ""s""": return(VerbsEndingInS.Take(3)); case "occupation": case "occupation or job": case "profession": return(Occupations.Take(3)); case "silly noise": return(SillyNoises.Take(3)); case "male celebrity": case "celebrity (male)": return(MaleCelebrities.Take(3)); case "article of clothing (plural)": return(PluralClothing.Take(3)); case "name of a school": case "school": return(Schools.Take(3)); case "building": return(Buildings.Take(3)); case "bird": return(Birds.Take(3)); case @"adjective ending in ""est""": case "adjective (superlative)": return(Superlatives.Take(3)); case "letter": return(Letters.Take(3)); case "game": return(Games.Take(3)); case "holiday": return(Holidays.Take(3)); case "silly word (plural)": return(PluralSillyWords.Take(3)); case "something round": return(RoundSomethings.Take(3)); case "piece of furniture": return(Furniture.Take(3)); case "vegetable": return(Vegetables.Take(3)); case "spanish word": return(SpanishWords.Take(3)); case "tv actor": return(TVActors.Take(3)); case "boy's name": return(BoyNames.Take(3)); case "something alive": return(AliveSomethings.Take(3)); case "female celebrity": case "celebrity (female)": return(FemaleCelebrities.Take(3)); case "italian word": return(ItalianWords.Take(3)); case "occupation (plural)": return(PluralOccupations.Take(3)); case "first name": return(FirstNames.Take(3)); case "room in a house": return(HouseRooms.Take(3)); case "relative": return(Relatives.Take(3)); case "movie star": return(MovieStars.Take(3)); case "disease": return(Diseases.Take(3)); case "sport": return(Sports.Take(3)); case "something icky": return(IckySomethings.Take(3)); case "actor": return(Actors.Take(3)); case "concept or ideal": return(Concepts.Take(3)); default: return(new string[3] { string.Empty, string.Empty, string.Empty }); } }
public IEnumerator OnTriggerEnter2D(Collider2D collider) { //If the object that's colliding is the player if (collider.tag == "tag_player") { PlayerMechanics playerMech = collider.GetComponent <PlayerMechanics>(); if (liquidInsideBeaker == Liquids.Acid) { Debug.Log("Colliding with player"); Debug.Log("Player is: " + playerMech.whatAmI); if (playerMech.whatAmI == "Haldi") { //playerMech.GetComponent<Animator>().SetBool("Haldi", false); //playerMech.GetComponent<Animator>().SetBool("KumKum", true); playerMech.whatAmI = "Haldi"; } //Kumkum to haldi else if (playerMech.whatAmI == "Kumkum") { Debug.Log("Starting the Transformation"); //Just calling this function sets the character to its appropriate color at the end of the function if (TransformationCoroutine != null) { StopCoroutine(TransformationCoroutine); TransformationCoroutine = null; } TransformationCoroutine = StartCoroutine(playerMech.Transformation()); //playerMech.whatAmI = "Haldi"; } } else if (liquidInsideBeaker == Liquids.Base) { //Haldi to Kumkum if (playerMech.whatAmI == "Haldi") { //playerMech.GetComponent<Animator>().SetBool("Haldi", false); //playerMech.GetComponent<Animator>().SetBool("KumKum", true); //Just calling this function sets the character to its appropriate color at the end of the function if (TransformationCoroutine != null) { StopCoroutine(TransformationCoroutine); TransformationCoroutine = null; } TransformationCoroutine = StartCoroutine(playerMech.Transformation()); } else if (playerMech.whatAmI == "Kumkum") { playerMech.whatAmI = "Kumkum"; } } //There's no change if the thing is neutral else if (liquidInsideBeaker == Liquids.Neutral) { if (playerMech.whatAmI == "Haldi") { //playerMech.GetComponent<Animator>().SetBool("Haldi", false); //playerMech.GetComponent<Animator>().SetBool("KumKum", true); playerMech.whatAmI = "Haldi"; } else if (playerMech.whatAmI == "Kumkum") { playerMech.whatAmI = "Kumkum"; } } } //If the object that's colliding is the box if (collider.tag == "tag_container") { Liquids liquidInsideContainer = collider.GetComponent <Container>().liquidInsideContainer; //Wait for a certain amount of time and then, change the liquid inside the beaker and destroy container yield return(new WaitForSeconds(1.5f)); if (liquidInsideContainer == Liquids.Acid) { if (liquidInsideBeaker == Liquids.Acid) { liquidInsideBeaker = Liquids.Acid; //ChangeName(); //ChangeMaterial(); } else if (liquidInsideBeaker == Liquids.Base) { liquidInsideBeaker = Liquids.Base; //ChangeName(); //ChangeMaterial(); } else if (liquidInsideBeaker == Liquids.Neutral) { liquidInsideBeaker = Liquids.Acid; //ChangeName(); //ChangeMaterial(); } } if (liquidInsideContainer == Liquids.Neutral) { if (liquidInsideBeaker == Liquids.Acid) { liquidInsideBeaker = Liquids.Acid; //ChangeName(); //ChangeMaterial(); } else if (liquidInsideBeaker == Liquids.Base) { liquidInsideBeaker = Liquids.Base; //ChangeName(); //ChangeMaterial(); } else if (liquidInsideBeaker == Liquids.Neutral) { liquidInsideBeaker = Liquids.Neutral; //ChangeName(); //ChangeMaterial(); } } if (liquidInsideContainer == Liquids.Base) { if (liquidInsideBeaker == Liquids.Acid) { liquidInsideBeaker = Liquids.Neutral; //ChangeName(); //ChangeMaterial(); } else if (liquidInsideBeaker == Liquids.Base) { liquidInsideBeaker = Liquids.Base; //ChangeName(); //ChangeMaterial(); } else if (liquidInsideBeaker == Liquids.Neutral) { liquidInsideBeaker = Liquids.Base; //ChangeName(); //ChangeMaterial(); } } //play some particle effect system which must be placed inside the level manager Destroy(collider.gameObject); } }