public void PickFruit(Fruits _fruit) { if (FruitPicked != null) { FruitPicked(_fruit); } if (!FruitsEaten.Contains(_fruit)) { _fruit.fruittype = (Fruits.FruitTtype)Random.Range(0, 2); FruitsEaten.Add(_fruit); } }
static ApplicationLogic() { meat = new Meat(); fruit = new Fruits(); nuts = new Nuts(); vegetables = new Vegetables(); fish = new Fish(); cereals = new Cereals(); bread = new Bread(); alchohol = new Alchohol(); softDrinks = new SoftDrinks(); user = new User("Winnie the Pooh"); }
/// <summary> /// Awakes this instance. /// Establece la variable estatica de clase /// </summary> private void Awake() { if (gm == null) { gm = this; } else if (gm != null) { Destroy(gameObject); } fruits = FindObjectOfType <Fruits>(); lm = FindObjectOfType <LifeManager>(); }
private static void TestMethod() { Console.WriteLine("Hello World!"); Fruits myFruit = Fruits.Apple; string myStringFruit = "Apple"; try { Fruits myFruit2 = (Fruits)Enum.Parse(typeof(Fruits), myStringFruit); } catch (Exception ex) { Console.WriteLine("Cannot convert this value into a fruit"); Console.WriteLine(ex.Message); } finally { Console.WriteLine("Finishing..."); } Fruits myFruit3; if (Enum.TryParse <Fruits>(myStringFruit, out myFruit3)) { } else { } int total = 0; RunningSum(7, ref total); Console.WriteLine(total); int total2; OutSum(4, 2, out total2); Console.WriteLine(total2); int[] Numbers = { 1, 2, 3, 4, 5, 6, 7 }; Sum(Numbers); SumParams(1, 2, 3, 4, 5, 6, 7); PrintAName(); PrintAName("Chris"); SetConfiguration(height: out total2, fullScreenEnables: false, width: ref total); }
public void populateComboBoxes() { //Populate Both ComboBoxes DataAccess db = new DataAccess(); foreach (var item in db.GetAllFruits()) { Fruits.Add(item.Name + " " + item.Color); } foreach (var item in db.GetAllPlanets()) { Planets.Add(item.Name2 + " " + item.Color2); } }
IEnumerator ReactivateInActiveFruits() { while (_searching) { yield return(new WaitForSeconds(2f)); if (FruitsEaten.Count != 0) { Fruits _fruit = FruitsEaten [Random.Range(0, FruitsEaten.Count)]; FruitsEaten.Remove(_fruit); _fruit.ReactivateFruit(); } } }
public void ClearTest() { const Fruits ALL_BUT_APPLE = Fruits.All & ~Fruits.Apple; const Fruits ALL_BUT_PEAR = Fruits.All & ~Fruits.Pear; const Fruits ALL_BUT_MANGO = Fruits.All & ~Fruits.Mango; Assert.That(Fruits.All.ClearFlag(Fruits.Apple) == ALL_BUT_APPLE); Assert.That(Fruits.All.ClearFlag(Fruits.Pear) == ALL_BUT_PEAR); Assert.That(Fruits.All.ClearFlag(Fruits.Mango) == ALL_BUT_MANGO); Assert.That(Fruits.All.ClearFlag(Fruits.Mango).ClearFlag(Fruits.Apple) == Fruits.Pear); Assert.That(Fruits.All.ClearFlag(Fruits.Pear).ClearFlag(Fruits.Mango) == Fruits.Apple); Assert.That(Fruits.All.ClearFlag(Fruits.Pear).ClearFlag(Fruits.Apple) == Fruits.Mango); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Fruits = await _context.Fruits.FirstOrDefaultAsync(m => m.Id == id); if (Fruits == null) { return(NotFound()); } return(Page()); }
private void ExecuteClearCommand() { Planets = new ObservableCollection <string>(); DataAccess db = new DataAccess(); db.ClearAllUserCreatedRows(); clearDataGrids(); updateRows(); FruitsSelectedItem = null; PlanetsSelectedItem = null; Fruits.Clear(); Planets.Clear(); populateComboBoxes(); }
public static void LoadData() { Map.entities = new List <Abstract_Entity>(); string[] lines = File.ReadAllLines(Map.Path + Map.file); Map.MaxRows = lines.Length; int row = 0; foreach (string line in lines) { char[] chars = line.ToCharArray(); Map.MaxColumns = chars.Length; int column = 0; foreach (char character in chars) { Abstract_Entity obj = null; switch (character) { case 'W': //Create Wall obj = new Wall(row, column); break; case 'D': //Create dot obj = new Dot(row, column); break; case 'B': //Create booster obj = new Booster(row, column); break; case 'F': //Create fruit obj = new Fruits(row, column); break; case 'R': //Create ghost room obj = new Ghost_Room(row, column); break; case 'T': //Create empty tile obj = new Empty_Tile(row, column); break; } Map.entities.Add(obj); column++; } row++; } }
public void SetTest() { const Fruits ALL_BUT_APPLE = Fruits.All & ~Fruits.Apple; const Fruits ALL_BUT_PEAR = Fruits.All & ~Fruits.Pear; const Fruits ALL_BUT_MANGO = Fruits.All & ~Fruits.Mango; Assert.That(ALL_BUT_APPLE.SetFlag(Fruits.Apple) == Fruits.All); Assert.That(ALL_BUT_PEAR.SetFlag(Fruits.Pear) == Fruits.All); Assert.That(ALL_BUT_MANGO.SetFlag(Fruits.Mango) == Fruits.All); Assert.That(Fruits.None.SetFlag(Fruits.Apple).SetFlag(Fruits.Pear) == ALL_BUT_MANGO); Assert.That(Fruits.None.SetFlag(Fruits.Apple).SetFlag(Fruits.Mango) == ALL_BUT_PEAR); Assert.That(Fruits.None.SetFlag(Fruits.Mango).SetFlag(Fruits.Pear) == ALL_BUT_APPLE); Assert.That(Fruits.None.SetFlag(Fruits.Apple).SetFlag(Fruits.Pear).SetFlag(Fruits.Mango) == Fruits.All); }
private void LoadFruits(XDocument doc) { var elemList = doc.Descendants("Fruit"); int x, y, sx, sy; foreach (var item in elemList) { int.TryParse(item.Attribute("X").Value, out x); int.TryParse(item.Attribute("Y").Value, out y); int.TryParse(item.Attribute("SizeX").Value, out sx); int.TryParse(item.Attribute("SizeY").Value, out sy); Fruits.Add(new Fruit { X = x, Y = y, SizeX = sx, SizeY = sy }); } }
public static void ToLookupDemo() { ILookup <string, Fruit> lookup = Fruits.ToLookup(e => e.Color); IEnumerator <IGrouping <string, Fruit> > groups = lookup.GetEnumerator(); while (groups.MoveNext()) { IGrouping <string, Fruit> group = groups.Current; Console.WriteLine("Group for {0}", group.Key); foreach (Fruit fruit in group) { Console.WriteLine($"new Fruit({fruit.ShelfLife},{ fruit.Name},{fruit.Color})"); } Console.WriteLine("\r\n"); } }
static void Main(string[] args) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); AProducts Abeef = new Beef(300, 20, MeatFactoryName.Лидский_Мясокомбинат, MeatProductType.Колбаса); ICrud <Beef> crud = new ICrudBeef(); ICrud <Fish> crud1 = new ICrudFish(); ICrud <Fruits> crud2 = new ICrudFruit(); Beef beef = crud.ReadByID(4); Fish fish = crud1.ReadByID(1); Fruits fruits = crud2.ReadByID(1); Console.WriteLine(beef); Console.WriteLine(fish); Console.WriteLine(fruits); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Fruits = await _context.Fruits.FindAsync(id); if (Fruits != null) { _context.Fruits.Remove(Fruits); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
protected override void Initialize(string filter, params object[] args) { var sql = "select id,result,start,end,preset from " + DBTables.Screening + " where " + filter; var res = DB.SExecuteReader(sql, args); if (res.Count == 0) { throw new DBCNoRecordException(); } var row = res[0]; ID = Convert.ToInt32(row[0]); Result = (Fruits)Convert.ToByte(row[1]); Start = Convert.ToDateTime(row[2]); End = Convert.ToDateTime(row[3]); _preset = (Fruits)Convert.ToByte(row[4]); }
public void ToggleTest() { const Fruits ALL_BUT_APPLE = Fruits.All & ~Fruits.Apple; const Fruits ALL_BUT_PEAR = Fruits.All & ~Fruits.Pear; const Fruits ALL_BUT_MANGO = Fruits.All & ~Fruits.Mango; Assert.That(Fruits.All.ToggleFlag(Fruits.Apple) == ALL_BUT_APPLE); Assert.That(Fruits.All.ToggleFlag(Fruits.Pear) == ALL_BUT_PEAR); Assert.That(Fruits.All.ToggleFlag(Fruits.Mango) == ALL_BUT_MANGO); Assert.That(ALL_BUT_APPLE.ToggleFlag(Fruits.Apple) == Fruits.All); Assert.That(ALL_BUT_PEAR.ToggleFlag(Fruits.Pear) == Fruits.All); Assert.That(ALL_BUT_MANGO.ToggleFlag(Fruits.Mango) == Fruits.All); Assert.That(Fruits.None.ToggleFlag(Fruits.Apple).ToggleFlag(Fruits.Pear).ToggleFlag(Fruits.Mango).ToggleFlag(Fruits.Apple) == ALL_BUT_APPLE); Assert.That(Fruits.None.ToggleFlag(Fruits.Apple).ToggleFlag(Fruits.Pear).ToggleFlag(Fruits.Mango).ToggleFlag(Fruits.Apple).ToggleFlag(Fruits.Pear) == Fruits.Mango); Assert.That(Fruits.None.ToggleFlag(Fruits.Apple).ToggleFlag(Fruits.Pear).ToggleFlag(Fruits.Mango).ToggleFlag(Fruits.Apple).ToggleFlag(Fruits.Pear).ToggleFlag(Fruits.Mango) == Fruits.None); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); // Fruits myFruit = Fruits.Apple; string myStringFruit = "Apple"; try { Fruits myFruit2 = (Fruits)Enum.Parse(typeof(Fruits), myStringFruit); } catch (Exception ex) { Console.WriteLine("Cannot convert this value into a Fruit"); Console.WriteLine(ex.Message); } finally { Console.WriteLine("Finishing..."); } int total = 3; RunningSum(7, ref total); Console.WriteLine(total); int total2; OutSum(4, 6, out total2); Console.WriteLine("Out Total:{0}", total2); int[] Numbers = { 1, 2, 3, 4, 5, 6, 7, 8 }; Sum(Numbers); SumParams(1, 2, 3, 4, 5, 6, 7, 8); PrintAName(); PrintAName("Ian"); SetConfiguration(height: out total2, fullScreenEnable: false, width: ref total); }
public void PrintFriuts(Fruits fr) { switch (fr) { case Fruits.Apple: Console.WriteLine("苹果"); break; case Fruits.Orange: Console.WriteLine("橘子"); break; case Fruits.Banana: Console.WriteLine("香蕉"); break; default: break; } }
private void OnAppearing() { Fruits.Clear(); Fruits.Add("Apple"); Fruits.Add("Orange"); Fruits.Add("Banana"); Fruits.Add("Pineapple"); Fruits.Add("Pear"); Fruits.Add("Grapes"); //**DEBUG HERE** //HERE THE POSITION = 0 BUT VISUALLY THE CAROUSEL DIFFERS. var position = FruitPosition; //**DEBUG HERE** //ON FIRST INSTANCE SELECTEDFRUIT IS NULL. IT SHOULD BE //SET TO APPLE. ON SUBSEQUANT RUNS IT REMAINS APPLE BUT //VISUALLY THE CAROUSEL DIFFERS. var selectedFruit = CurrentFruit; }
private Product AddNewProduct(string[] splittedValues) //return kann parent PRODUCT sein und alle Kinder auch zurückgeben!!!!! { Product newProd; //initialisieren ohne zuweisung GEHT!!! string type = splittedValues[4].ToLower(); if (type == "alcohol") { newProd = new Alcohol(); } else if (type == "fruits") { newProd = new Fruits(); } else if (type == "sweets") { newProd = new Sweets(); } else { newProd = new Vegetables(); } newProd.ID = splittedValues[0]; newProd.Cost = double.Parse(splittedValues[1].Replace("€", "")); newProd.Name = splittedValues[2]; newProd.Usebefore = splittedValues[3]; newProd.Type = type; if (splittedValues[5] == "normal") { newProd.Storagetype = Storagetype.NORMAL; } else if (splittedValues[5] == "fridge") { newProd.Storagetype = Storagetype.FRIDGE; } else if (splittedValues[5] == "freezer") { newProd.Storagetype = Storagetype.FREEZER; } return(newProd); }
private void CreateFruits() { if (fruitsCreator.HasEatenDotEnough(eatenDot)) { fruits = fruitsCreator.Create(maze, mazeIndex); //パックマンが食べたときの処理。 fruits.OnEaten += (s, e) => { var f = (Fruits)s; //得点の更新。 score += f.Score; scoreText.text = score.ToString(); //得点を表示。 scorer.Set(f.Score, f.transform.position, eatSpan); //SEを再生。 soundManager.PlaySE("EatPowerCokie", 0.2f); }; } }
protected override Task <IReadOnlyList <CompletionItem> > GetCompletionItemsAsync(string text, int caret, TextSpan spanToBeReplaced, CancellationToken cancellationToken) { // demo completion algorithm callback // populate completions and documentation for autocompletion window var typedWord = text.AsSpan(spanToBeReplaced.Start, spanToBeReplaced.Length).ToString(); return(Task.FromResult <IReadOnlyList <CompletionItem> >( Fruits .Select(fruit => { var displayText = new FormattedString(fruit.Name, new FormatSpan(0, fruit.Name.Length, fruit.Highlight)); var description = GetFormattedString(fruit.Description); return new CompletionItem( replacementText: fruit.Name, displayText: displayText, getExtendedDescription: _ => Task.FromResult(description) ); }) .ToArray() )); }
static void Main(string[] args) { string conn = "2"; int qty = 0; bool t, b; int order; do { do { Console.WriteLine("Menu:"); Console.WriteLine("1.Apple (RM1)"); Console.WriteLine("2.Grape (RM2)"); Console.WriteLine("3.Banana (RM3)"); Console.WriteLine("***Buy 10 - 10% discount.***"); Console.WriteLine("***Buy 20 - 30% discount.***"); order = Convert.ToInt32(Console.ReadLine()); b = Fruits.validateOrder(order); } while (b); fruitName fn = (fruitName)Enum.Parse(typeof(fruitName), Convert.ToString(order)); do { Console.WriteLine("How many would you like to buy?"); qty = Convert.ToInt32(Console.ReadLine()); t = Fruits.validateQty(qty); } while (t); Fruits f = new Fruits(); double Total = f.getSubTotal(fn, qty); Console.WriteLine("Total:{0}", Total); Console.WriteLine("Continue shop?"); Console.WriteLine("1.Yes"); Console.WriteLine("2.No"); conn = Console.ReadLine(); } while (conn == "1"); }
static void Main() { Store store = new Store(); Cart cart = new Cart(); Fruits f = new Fruits("Apple", 1, (int)Prices.Fruits); Fish fish = new Fish("Fugu", 1, (int)Prices.Fish); Powder p = new Powder("Gala", (int)Prices.Powder); Detergent d = new Detergent("Ariel", (int)Prices.Detergent, 1); cart.AddToCartChemie(p); cart.AddToCartChemie(d); cart.AddToCartFood(f); cart.AddToCartFood(fish); store.AddToCart(cart); store.ShowAllCarts(); }
public IceCreamBase Addon(int toppings, IceCreamBase icecream) { switch (toppings) { case (int)Toppings.Chocochips: icecream = new Chocochips(icecream); break; case (int)Toppings.Cookies: icecream = new Cookies(icecream); break; case (int)Toppings.Jelly: icecream = new Jelly(icecream); break; case (int)Toppings.Fruits: icecream = new Fruits(icecream); break; case (int)Toppings.Almonnd: icecream = new Almond(icecream); break; case (int)Toppings.Cashew: icecream = new Cashew(icecream); break; case (int)Toppings.Pistachio: icecream = new Pistachio(icecream); break; default: break; } return(icecream); }
public static Theme CreateTheme(string theme) { if (theme.ToLower() == "fruits") { string[] wordPool = { "Banana", "Watermelon", "Apple", "Strawberry", "Orange", "Coconut", "Carambola", "Grapes", "Lemon", "Mango", "Pear", "Pitanga", "Tangerine", "Plum", "Pitaya" }; string[] hexColors = { "#FF0", "#0F0", "#F00", "#F00", "#E25822", "#FFF", "#FF0", "#800080", "#0F0", "#FF0", "#0F0", "#DAA520", "#E25822", "#800080", "#DE3163" }; if (GameManager.instance.fruits == null) { Fruits fruits = new Fruits(theme, 5, wordPool, hexColors, 20, 20); GameManager.instance.fruits = fruits; } return(GameManager.instance.fruits); } else if (theme.ToLower() == "colors") { string[] wordPool = { "White", "Black", "Blue", "Yellow", "Brown", "Pink", "Purple", "Orange", "Green", "Red", "Cyan", "Gold", "Salmon", "Gray", "Magenta" }; string[] hexColors = { "#FFF", "#000", "#00F", "#FF0", "#964b00", "#DE3163", "#800080", "#E25822", "#0F0", "#F00", "0FF", "#DAA520", "#E55137", "#666", "#F0F" }; if (GameManager.instance.colors == null) { Colors colors = new Colors(theme, 5, wordPool, hexColors, 20, 20); GameManager.instance.colors = colors; } return(GameManager.instance.colors); } else { return(null); } }
public void MainMethod() { //foreach (string s in Enum.GetNames(typeof(Fruits))) // Console.WriteLine(s); //string name = Enum.GetName(typeof(Fruits), 2); //Console.WriteLine(name); int mangoInt = 2; //var mangovar = GetEnumValue<Fruits>(mango); //Console.WriteLine(mangovar); //Fruits foo = (Fruits)Enum.Parse(typeof(Fruits), mango.ToString()); //Console.WriteLine("type" + foo); Fruits fruitsValue = GetEnumFromInt <Fruits>(mangoInt); Console.WriteLine(fruitsValue); int appleInt = 1; Fruits apple = (Fruits)Enum.Parse(typeof(Fruits), appleInt.ToString()); Console.WriteLine(apple); }
private void InitialiseKeyboard(IWindowManipulationService windowManipulationService) { if (Settings.Default.ConversationOnlyMode) { Keyboard = new ConversationAlpha(null); windowManipulationService.Maximise(); } else { switch (Settings.Default.StartupKeyboard) { case Enums.Keyboards.Alpha: Keyboard = new Alpha(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); windowManipulationService.Maximise(); break; case Enums.Keyboards.ConversationAlpha: Keyboard = new ConversationAlpha(() => { Keyboard = new Menu(() => Keyboard = new Alpha()); mainWindowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); }); windowManipulationService.Maximise(); break; case Enums.Keyboards.ConversationNumericAndSymbols: Keyboard = new ConversationNumericAndSymbols(() => { Keyboard = new Menu(() => Keyboard = new Alpha()); mainWindowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); }); windowManipulationService.Maximise(); break; case Enums.Keyboards.Currencies1: Keyboard = new Currencies1(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.Currencies2: Keyboard = new Currencies2(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.Diacritics1: Keyboard = new Diacritics1(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.Diacritics2: Keyboard = new Diacritics2(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.Diacritics3: Keyboard = new Diacritics3(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.Food: Keyboard = new Food(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.Menu: Keyboard = new Menu(() => Keyboard = new Alpha()); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.Minimised: Keyboard = new Minimised(() => { Keyboard = new Menu(() => Keyboard = new Alpha()); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); }); windowManipulationService.Minimise(); break; case Enums.Keyboards.Mouse: Keyboard = new Mouse(() => Keyboard = new Menu(() => Keyboard = new Alpha())); windowManipulationService.Restore(); if (Settings.Default.MouseKeyboardDockSize == DockSizes.Full) { mainWindowManipulationService.ResizeDockToFull(); } else { mainWindowManipulationService.ResizeDockToCollapsed(); } break; case Enums.Keyboards.NumericAndSymbols1: Keyboard = new NumericAndSymbols1(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.NumericAndSymbols2: Keyboard = new NumericAndSymbols2(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.NumericAndSymbols3: Keyboard = new NumericAndSymbols3(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.PhysicalKeys: Keyboard = new PhysicalKeys(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.SizeAndPosition: Keyboard = new SizeAndPosition(() => Keyboard = new Menu(() => Keyboard = new Alpha())); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.emotionKeyboardKeyboard: Keyboard = new emotionKeyboard(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.PeopleKeyboard: Keyboard = new People(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.SportKeyboard: Keyboard = new Sport(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.CountriesKeyboard: Keyboard = new Countries(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.PlacesKeyboard: Keyboard = new Places(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.WeatherKeyboard: Keyboard = new Weather(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.BathroomKeyboard: Keyboard = new Bathroom(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.HouseholdKeyboard: Keyboard = new Household(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.ClothesKeyboard: Keyboard = new Clothes(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.EntertainmentKeyboard: Keyboard = new Entertainment(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.TimeKeyboard: Keyboard = new Time(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.GesturesKeyboard: Keyboard = new Gestures(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.AnimalsKeyboard: Keyboard = new Animals(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.DrinksKeyboard: Keyboard = new Drinks(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.FruitsKeyboard: Keyboard = new Fruits(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; case Enums.Keyboards.VegetablesKeyboard: Keyboard = new Vegetables(); windowManipulationService.Restore(); mainWindowManipulationService.ResizeDockToFull(); break; } } }
/// <summary> /// Handles The Random Spawns of fruits when the player score is added 1200 points /// </summary> private void SpawnFruit() { int type; List <Point> availablePositions = new List <Point>(); string[] file = File.ReadAllLines($@"{Content.RootDirectory}\board.txt"); int width = file[0].Length; int height = file.Length; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { switch (file[y][x]) { case ' ': availablePositions.Add(new Point(x, y)); break; } } } int chance = Rnd.Next(0, 100); if (chance <= 50) { type = 0; } else if (chance <= 75) { type = 1; } else if (chance <= 90) { type = 2; } else if (chance <= 98) { type = 3; } else { type = 4; } int index = Rnd.Next(availablePositions.Count); Point position = availablePositions[index]; PacDot dot = PacDots.FirstOrDefault(p => p.Position == position); if (dot != null) { PacDots.Remove(dot); Components.Remove(dot); } Fruit fruit = new Fruit(this, position, type); Fruits.Add(fruit); Components.Add(fruit); }
//Method for adding an item public void PickUpFruit(Fruits fruit) { //Checking each array spot to see if it is empty if(itemArray[0] == null) { itemArray[0] = fruit; } else if (itemArray[1] == null) { fruitPos = 1; itemArray[1] = fruit; } else if (itemArray[2] == null) { fruitPos = 2; itemArray[2] = fruit; } else if (itemArray[3] == null) { fruitPos = 3; itemArray[3] = fruit; } else if (itemArray[4] == null) { fruitPos = 4; itemArray[4] = fruit; } else if (itemArray[5] == null) { fruitPos = 5; itemArray[5] = fruit; } //If the array is full, tell the player else { Console.WriteLine("You are carrying too many items!"); } }
public object Clone() { Fruits clonedItem = new Fruits(null, Mass, Description, ItemValue, _stats); clonedItem.Type = Type; clonedItem.SortingLayer = SortingLayer; clonedItem.InventorySprite = InventorySprite; clonedItem.InGameSprite = InGameSprite; clonedItem.Count = Count; return clonedItem; }