// Use this for initialization private void Awake() { SegmentBody segInfo = new SegmentBody(); // Timer for generating segments timerMax = 0.8f; timer = timerMax; spriteRender = GetComponent <SpriteRenderer>(); // Find length from center of player's ship to border boxCollider2D = GetComponent <BoxCollider2D>(); Vector3 pos = transform.position; leftradius = pos.x - boxCollider2D.bounds.min.x; upperradius = pos.y - boxCollider2D.bounds.min.y; spriteRender = GetComponent <SpriteRenderer>(); centipede = Resources.Load <Centipede>("Centipede"); mushrooms = Resources.Load <Mushrooms>("Mushroom"); bullet = Resources.Load <Bullet>("Bullet"); wizard = Resources.Load <Wizard>("Wizard"); Debug.Log("Centipede_Panimatstarted"); //levelGrid = new LevelGrid(10, 10); GetCameraSizes(); newWizard = Instantiate(wizard); }
public void Init(Mushrooms m) { this._Mushrooms = m; _MushroomsRipeState = StateMachine <RipeState> .Initialize(this, RipeState.NULL); int stage = 1; scheduler.Timeout(() => { ChangeState(RipeState.Ripe1); }, m.SurplusTime / stage++); scheduler.Timeout(() => { ChangeState(RipeState.Ripe2); }, m.SurplusTime / stage++); scheduler.Timeout(() => { ChangeState(RipeState.Ripe3); }, m.SurplusTime / stage++); scheduler.Timeout(() => { ChangeState(RipeState.Ripe4); }, m.SurplusTime / stage++); }
public void Test_Mushrooms() { var sut = new Mushrooms(); Assert.True(sut.Name.Equals("Mushrooms")); Assert.True(sut.Price.Equals(2.00m)); }
async Task GetInSeasonAsync() { if (IsBusy) { return; } try { IsBusy = true; getNowAsInt(); for (var i = 0; i < ListingShrooms.Count; i++) { Mushrooms m = ListingShrooms.ElementAt(i); if (!(Today >= m.SeasonStart && Today <= m.SeasonEnd)) { ListingShrooms.Remove(m); i--; } } if (ListingShrooms.Count == 0) { await Application.Current.MainPage.DisplayAlert("Sorry", "None known to be is season", "Ok"); } } catch (Exception e) { Debug.WriteLine($"Error retieving data: {e.Message}"); await Application.Current.MainPage.DisplayAlert("Error", e.Message, "Ok"); } finally { IsBusy = false; } }
private static Food GetFood(string item) { Food food; item = item.ToLower(); if (item == "apple") { food = new Apple(); } else if (item == "cram") { food = new Cram(); } else if (item == "honeycake") { food = new HoneyCake(); } else if (item == "lembas") { food = new Lembas(); } else if (item == "melon") { food = new Melon(); } else if (item == "mushrooms") { food = new Mushrooms(); } else { food = new Other(); } return(food); }
public DetailsPage(Mushrooms mushroom) { InitializeComponent(); BindingContext = new FungiDetailsView(mushroom); DataContext = BindingContext; // alternatively as already instantiated in the xml //((FungiDetailsView)BindingContext).Mushroom = mushroom; }
public async Task <IEnumerable <Mushrooms> > GetMushroomsAsync() { return(Mushrooms.FromJson(await Client.GetStringAsync("https://raw.githubusercontent.com/daryl-crosbie/JSON/master/Mushrooms.json"))); /*var json = await Client.GetStringAsync("https://raw.githubusercontent.com/daryl-crosbie/JSON/master/Mushrooms.json"); * var shrooms = Mushrooms.FromJson(json); * return shrooms; */ }
public void Mushrooms_InvalidData() { int N = 10; int X = 11; Mushrooms mushrooms = new Mushrooms(); int white_mushrooms = 0; int expected_whitemushrooms = -1; white_mushrooms = mushrooms.CalculateWhiteMushrroms(N, X); Assert.AreEqual(expected_whitemushrooms, white_mushrooms); }
// Use this for initialization private void Awake() { mushrooms = Resources.Load <Mushrooms>("Mushroom"); // Simulating segment ID segmentNumber = SegmentBody.AddSegment(); spriteRenderer = GetComponent <SpriteRenderer>(); spriteRenderer.sprite = Resources.Load <Sprite>("PartBody"); GetCameraSizes(); gridPosition = new Vector2(0, maxY - 1); }
public void Mushrooms_Solution() { int N = 10; int X = 4; Mushrooms mushrooms = new Mushrooms(); int white_mushrooms = 0; int red_mushrooms = 0; int expected_whitemushrooms = 2; int expected_redmushrooms = 8; white_mushrooms = mushrooms.CalculateWhiteMushrroms(N, X); red_mushrooms = X * white_mushrooms; Assert.AreEqual(expected_whitemushrooms, white_mushrooms); Assert.AreEqual(expected_redmushrooms, red_mushrooms); }
public void Mushrooms_XNoDividedN() { int N = 10; int X = 3; Mushrooms mushrooms = new Mushrooms(); int white_mushrooms = 0; int red_mushrooms = 0; int expected_whitemushrooms = 0; int expected_redmushrooms = 0; white_mushrooms = mushrooms.CalculateWhiteMushrroms(N, X); red_mushrooms = X * white_mushrooms; Assert.AreEqual(expected_whitemushrooms, white_mushrooms); Assert.AreEqual(expected_redmushrooms, red_mushrooms); }
private void GenerateMushrooms() { for (int i = (int)minX + 2; i < (int)maxX - 2; i++) { for (int j = -3; j < 3; j++) { int chance = Random.Range(0, 100); Debug.Log(chance); if (chance >= 90) { Mushrooms newMushrooms = Instantiate(mushrooms, new Vector3(i, j), mushrooms.transform.rotation); } } } }
private void OnTriggerEnter2D(Collider2D collider) { Part part = collider.GetComponent <Part>(); if (part is Wizard) { part.ReceiveDamage(); } if (part is Mushrooms) { Mushrooms EnterMush = new Mushrooms(); Vector3 pos = transform.position; pos.x += 0.9f; pos.y += 0.9f; transform.position = pos; } }
public int CalculateHappiness(string[] foods) { int happiness = 0; foreach (var food in foods) { switch (food.ToLower()) { case "cram": happiness += new Cram().HappinessPoints; break; case "lembas": happiness += new Lembas().HappinessPoints; break; case "apple": happiness += new Apple().HappinessPoints; break; case "melon": happiness += new Melon().HappinessPoints; break; case "honeycake": happiness += new HoneyCake().HappinessPoints; break; case "mushrooms": happiness += new Mushrooms().HappinessPoints; break; default: int everythingElse = -1; happiness += everythingElse; break; } } return(happiness); }
public void Init(Mushrooms m) { this._Mushrooms = m; _MushroomsWitherState = StateMachine <WitherState> .Initialize(this, WitherState.NULL); int stage = 1; scheduler.Timeout(() => { ChangeState(WitherState.Wither1); }, m.SurplusTime / stage++); scheduler.Timeout(() => { ChangeState(WitherState.Wither2); }, m.SurplusTime / stage++); scheduler.Timeout(() => { ChangeState(WitherState.Wither3); }, m.SurplusTime / stage++); }
public override void ReceiveDamage() { try { if (SegmentBody.centipede[segmentNumber + 1] != null) { Centipede CurrentSegment = (Centipede)SegmentBody.centipede[segmentNumber + 1]; CurrentSegment.spriteRenderer.sprite = Resources.Load <Sprite>("Centipede"); } } catch (Exception exception) { Debug.Log(exception.ToString()); } Vector3 position = transform.position; Mushrooms newMushrooms = Instantiate(mushrooms, position, mushrooms.transform.rotation); GameHandler.score += (GameHandler.wave * 2); GameHandler.livingSegments--; base.ReceiveDamage(); }
public Food.Food GetFood(string food) { Food.Food currentFood; switch (food) { case "cram": currentFood = new Cram(); break; case "lembas": currentFood = new Lembas();; break; case "apple": currentFood = new Apple();; break; case "melon": currentFood = new Melon(); break; case "honeycake": currentFood = new HoneyCake(); break; case "mushroom": currentFood = new Mushrooms(); break; default: currentFood = null; break; } return(currentFood); }
public virtual Food CreateFood(string name) { Food food = null; switch (name) { case "cram": food = new Cram(2); break; case "lembas": food = new Lembas(3); break; case "apple": food = new Apple(1); break; case "melon": food = new Melon(1); break; case "honeycake": food = new HoneyCake(5); break; case "mushrooms": food = new Mushrooms(-10); break; default: food = new Misc(-1); break; } return(food); }
public static void StartOnEngine(IEngine engine) { var loader = ResourceCachedLoader.Instance; var darkFloorTexture = loader.GetSprite("./sprites/dark/floor.PNG"); var darkCeilTexture = loader.GetSprite("./sprites/dark/ceil.PNG"); var darkWallTexture = loader.GetSprite("./sprites/dark/wall.PNG"); var wallTexture = Sprite.Load("./sprites/wall2.png"); var floorTexture = Sprite.Load("./sprites/floor2.png"); var ceilingTexture = Sprite.Load("./sprites/ceiling2.png"); var entranceTexture = Sprite.Load("./sprites/dark/entrance.PNG"); var doorAnimation = loader.GetAnimation("./animations/door"); var textureStorage = new MapTextureStorage( darkFloorTexture, darkCeilTexture, darkWallTexture, floorTexture, wallTexture, ceilingTexture, entranceTexture, doorAnimation); var scene = SceneReader.ReadFromStrings(new[] { "$$$e$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", "$P,,H$,,,,,,,,,,,,$AH,,,,,,,,,,,,,,,$#$e$############$", "$,,,A$,,,,,,,,,,,,$AH,,,,,,,,,,,S,,,$#......##..R...#$", "$M$$$$,,,,,,,,,,,,$,,,,,,,,,,,,,,,,,$#....S.##......#$", "$,$,,,,,,,,,,,,,,,$$$$$$$$$$$$,,,,,,$#...#.........L#$", "$,$,,,,,,,,,,,,,,,,,,,,,,$HM$$d$,,$$$#S.......M.....#$", "$,$$$$$$$$$$$$$$$$$$$$$$$$$,,,,$,,$###......##......#$", "$,,,,,,,R,,,,,,,,,,,,,R,,,,,,,,$,,$##..##...##......#$", "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,,$#...##....########$", "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$,,$#.....M..........#$", "$,,,,,,,,,,,,,,S,,,,,,,,,,,,,,,,,,$#####...##########$", "$,,,,R,,,,,,,,,,M,,,,,,,,S,,,,,,,,$##...............#$", "$,,$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$.###.............#$", "$,,$$##################################.............#$", "$$,,$$$MM,,,,,,,,,,.................................#$", "$$$,,,$$$$,H$RS$$$AA####################d############$", "$$$$$,,S,$$$$$$$$$$$$...HH..AA....S.#..#.#....#######$", "$,,$$$$,,,,,$$$,R,,,d.....S...MM..............#######$", "$,,,,,$$$$,,,M,,,$$$$################.........#######$", "$,,,,,,,,$$$$$$$$,,,,,,,,,,,,,,,,,,,###########,,,,,,$", "$,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,$", "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$", }, textureStorage.GetCellByChar, MathF.PI / 2); // scene.AddObject(SpiderNet.Create()); scene.AddObject(SpiderNet.Create(new Vector2(2.5f, 14.5f))); scene.AddObject(SpiderNet.Create(new Vector2(3.5f, 14.5f))); scene.AddObject(SpiderNet.Create(new Vector2(1.5f, 5.5f))); scene.AddObject(SpiderNet.Create(new Vector2(10.5f, 7.5f))); scene.AddObject(SpiderNet.Create(new Vector2(27.5f, 5.5f))); scene.AddObject(Mushrooms.Create(new Vector2(8.5f, 7.5f))); scene.AddObject(Mushrooms2.Create(new Vector2(12.5f, 7.5f))); scene.AddObject(Mushrooms2.Create(new Vector2(33.5f, 9.5f))); scene.AddObject(Lamp1.Create(new Vector2(15.5f, 7.5f))); scene.AddObject(Bones.Create(new Vector2(26.5f, 7.5f))); scene.AddObject(Bones.Create(new Vector2(26.5f, 3.5f))); scene.AddObject(Bones.Create(new Vector2(24.5f, 2.5f))); scene.AddObject(Bones.Create(new Vector2(2.5f, 10.5f))); scene.AddObject(Bones.Create(new Vector2(40.5f, 9.5f))); scene.AddObject(SpiderNet.Create(new Vector2(12.5f, 11.5f))); scene.AddObject(Bones.Create(new Vector2(16.5f, 10.5f))); scene.AddObject(Mushrooms.Create(new Vector2(22.5f, 1.5f))); scene.AddObject(SpiderNet.Create(new Vector2(35.5f, 1.5f))); scene.AddObject( Note.Create(new Vector2(37.5f - 18, 3.5f), "Ещё одна запись в дневнике, я становлюсь одержимым?\n" + "Этот ход через официальную лабораторию\n" + "был неплохо спрятан от внешних глаз, но я осторожный\n" + "Пожалуй, поставлю сюда какую-нибудь охрану.\n" + "Желательно чтобы она не могла разболтать, что она охраняет.")); scene.AddObject( Note.Create(new Vector2(40.5f, 18.5f), "По моим последним данным - источник магии на планете - Солнце\n" + "Многие бы отказались от своей идеи, имея такое препятствие.\n" + "Многие, но не я.\n" + "Мне повезло родиться могущественным волшебником. Даже очень.\n" + "Одно из того, на что могут повлиять волшебники - гравитация.\n" + "Через 2 года недалеко от нашей системы будет пролетать чёрная дыра\n" + "Такой шанс выпадает раз в тысячу лет. Не воспользоваться - грех.")); scene.AddObject( Note.Create(new Vector2(50.5f, 11.5f), "Да, все расчёты верны!\n" + "Небольшой манёвр поможет планете вырваться от нашего Солнца!\n" + "Притянуты чёрной дырой мы не будем, а просто улетим с текущей орбиты\n" + "Однако проблема - полёт займёт несколько десятков тысяч лет\n" + "За столько лет вся разумная жизнь на планете вымрет\n" + " \n" + "Но и на это у меня есть ответ: заморозим время на планете в некоторой\n" + "области, где укроются люди\n" + "Главное, чтобы никто не мешал - никому не понравится такой полёт\n")); scene.AddObject(Lamp1.Create(new Vector2(36.5f, 17.5f))); scene.AddObject(Lamp1.Create(new Vector2(40.5f, 16.5f))); var music = loader.GetMusic(MusicResourceHelper.EnvironmentDungeonMusic); music.Play(-1); Trigger.AddTrigger(3, 1, (scene) => { scene.Player.CurrentMonologue = new Monologue(new[] { ("Пахнет крысами. Опять.", 3000) });
public Mushroom(Mushrooms mush) { mushroom = mush; }
static void Main(string[] args) { try { int totalpoints = 0; string a = Console.ReadLine(); string[] s = a.Split(' '); if (a.Length > 1000) { throw new Exception("The characters in the input string will be no more than: 1000"); } if (s.Length < 1 || s.Length > 100) { throw new Exception("The food count would be in the range [1…100]."); } string caseSwitch; foreach (var p in s) { caseSwitch = p; switch (caseSwitch) { case "Apple": Apple apple = new Apple(p); totalpoints += apple.Point; break; case "Cram": Cram cram = new Cram(p); totalpoints += cram.Point; break; case "HoneyCake": HoneyCake honeyCake = new HoneyCake(p); totalpoints += honeyCake.Point; break; case "Lembas": Lembas lembas = new Lembas(p); totalpoints += lembas.Point; break; case "Melon": Melon melon = new Melon(p); totalpoints += melon.Point; break; case "Mushrooms": Mushrooms mushrooms = new Mushrooms(p); totalpoints += mushrooms.Point; break; default: EverithingElse everithingElse = new EverithingElse(p); totalpoints += everithingElse.Point; break; } } if (totalpoints < -5) { Angry angry = new Angry(); Console.WriteLine(totalpoints); angry.Output(); } else if (totalpoints >= 1 && totalpoints <= 15) { Happy happy = new Happy(); Console.WriteLine(totalpoints); happy.Output(); } else if (totalpoints >= -5 && totalpoints <= 0) { Sad sad = new Sad(); Console.WriteLine(totalpoints); sad.Output(); } else if (totalpoints > 15) { JavaScript javaScript = new JavaScript(); Console.WriteLine(totalpoints); javaScript.Output(); } } catch (Exception ex) { Console.WriteLine($"{ex.Message}"); } Console.ReadKey(); }
private void Test() { Mushrooms m = _MushroomsPool.New(); }
public void Create(MushroomsCfgElement e) { Mushrooms m = _MushroomsPool.New(); m.Init(e); }