/// <summary> /// 随机生成蘑菇 /// </summary> void CreateMushrooms() { if (clusterIndex < clusterCount) { int x = Random.Range(-100, 100); int z = Random.Range(-100, 100); int i = 48 - (Mathf.FloorToInt(z / 5) + 20); if (x >= riverEdgeL[i] && x <= riverEdgeR[i]) { // Util.LogR(clusterIndex, x, z, i, riverEdgeL[i], riverEdgeR[i]); return; } // else // Util.Log(clusterIndex, x, z, i, riverEdgeL[i], riverEdgeR[i]); Vector3 clusterPos = new Vector3(x, 0, z); GameObject clusterObj = new GameObject("cluster_" + clusterIndex); clusterObj.transform.position = clusterPos; clusters.Add(clusterObj); int count = Random.Range(mrMinCount, mrMaxCount); for (int j = 0; j < count; j++) { Transform clusterTrans = clusterObj.transform; Vector3 lPos = new Vector3(Random.Range(-clusterRadius, clusterRadius), 0, Random.Range(-clusterRadius, clusterRadius)); Mushroom tree = new Mushroom(lPos); tree.transform.SetParent(clusterTrans); tree.transform.localPosition = lPos; } clusterIndex++; } }
public static GameElement Create(EElementType elementType) { GameElement gameElement = null; switch (elementType) { case EElementType.D_WaterHell: gameElement = new WaterHell(); break; case EElementType.O_CarnivoreFruit: gameElement = new CarnivoreFruit(); break; case EElementType.O_DominoSpider: gameElement = new DominoSpider(); break; case EElementType.O_Mushroom: gameElement = new Mushroom(); break; case EElementType.O_WoolBall: gameElement = new WoolBall(); break; case EElementType.S_DesyncSound: gameElement = new DesyncSoud(); break; case EElementType.F_MushroomJose: gameElement = new MushroomJose(); break; default: gameElement = null; break; } return gameElement; }
private void HandleDisplaySign() { if (Time.time - eatStartTime > eatCooldown) { eatStartTime = Time.time; closestMushroom = null; float minDist = 1000; GameObject[] mushrooms = GameObject.FindGameObjectsWithTag("Mushroom"); foreach (var mushroom in mushrooms) { float distance = (mushroom.transform.position - transform.position + eatOffset).magnitude; Mushroom mushroomComponent = mushroom.GetComponent <Mushroom>(); if (mushroomComponent && mushroomComponent.isConsumable() && distance < eatRadius) { if (distance < minDist) { closestMushroom = mushroom; minDist = distance; } } } } eatSign.SetActive(false); if (closestMushroom) { eatSign.transform.position = closestMushroom.transform.position; eatSign.SetActive(true); } }
void Update() { if (raisingPowerup) { if (myPowerup != null && myPowerup.transform.position.y < transform.position.y + 1) { myPowerup.transform.position += Vector3.up * Time.deltaTime * raiseSpeed; if (myPowerup.transform.position.y > transform.position.y + 1) { myPowerup.transform.position = transform.position + Vector3.up * 1.0f; Mushroom m = myPowerup.GetComponent <Mushroom> (); if (m != null) { m.Activate(); } //Destroy (this); } } else { Destroy(this); } } }
public override void HitBlock() { if (capacity == 0) { return; } base.HitBlock(); // TODO: Handle coin animation capacity--; switch (questionBoxItem) { case Content.Mushroom: Mushroom mushroom = Instantiate(mushroomPrefab, transform).GetComponent <Mushroom>(); StartCoroutine(mushroom.AnimateOutOfBox(transform.position)); break; case Content.Coin: case Content.TenCoin: Coin coin = Instantiate(coinPrefab, transform).GetComponent <Coin>(); StartCoroutine(coin.BounceCoin(transform.position)); break; case Content.FireFlower: break; } }
public void LoadDataFromXmlDocument() { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Environment.CurrentDirectory; openFileDialog.Filter = "XML Files (*.xml)|*.xml"; if (openFileDialog.ShowDialog() == true) { try { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(openFileDialog.FileName); CurrentBasket.ListOfMushroom.Clear(); foreach (XmlNode node in xmlDocument.DocumentElement.ChildNodes) { Mushroom newMushroom = new Mushroom(); newMushroom.DiameterOfTheHat = double.TryParse(node["srednica_kapelusza"].InnerText, out double Srednica_kapelusza) ? Srednica_kapelusza : 0; newMushroom.Lamella = double.TryParse(node["blaszki"].InnerText, out double Blaszki) ? Blaszki : 0; newMushroom.Toxins = double.TryParse(node["toksyny"].InnerText, out double Toksyny) ? Toksyny : 0; newMushroom.Edibility = node["cl"].InnerText; CurrentBasket.ListOfMushroom.Add(newMushroom); } Logger.WriteLog($"[{DateTime.Now}] Load data from xml success!"); } catch (Exception ex) { MessageBox.Show("Niepoprawny plik xml"); Logger.WriteLog($"[{DateTime.Now}] {ex.Message}"); } } }
// Use this for initialization void Start() { //Get the player, enemy and mushroom scripts in order to use them later playerScript = gameObject.GetComponent <MainPlayerScript>(); charName = playerScript.playerName; enemyScript = GameObject.Find("EnemyPlayer").GetComponent <EnemyPlayerScript>(); mushroomScript = gameObject.GetComponent <Mushroom>(); //A string which holds the path to the database, which will be called in a function later on string conn = "URI=file:" + Application.dataPath + "/kristiyan_nenov_cw.db"; IDbConnection dbconn; //creates a db connection entity dbconn = (IDbConnection) new SqliteConnection(conn); //opens the sqlite connection through the connection entity dbconn.Open(); //Open connection to the database. dbcmd = dbconn.CreateCommand(); //Uses the create command functionality, which enables script-like queries to the database PlayerTable(); EnemyTable(); CountMushrooms(); SpawnMushrooms(); //Closes everything and makes sure all values are set to null dbcmd.Dispose(); dbcmd = null; dbconn.Close(); dbconn = null; }
void JumpFinished() { Mushroom mushroom = Instantiate(m_Mushroom) as Mushroom; mushroom.transform.parent = transform; mushroom.transform.localPosition = Vector3.zero; }
public void TestMash(MushroomKind kind) { var food = new Mushroom(kind); Assert.AreEqual(food.EffectType, EffectType.Poisoned); TestPoisonous(food); }
public IEntity[] Generate() { List <Mushroom> mushrooms = new List <Mushroom>(); Block[] collisions = level.Manager.GetAllBlocks(BlockFilter.Top, false); int maximum = Rand.Next(2, 5); for (int i = 0; i < collisions.Length; i++) { if (Rand.Next(2) == 0) { Vector2 spawn = new Vector2(collisions[i].X, collisions[i].Y - Mushroom.Size.Y); Fireball fb = new Fireball(fireballSheet, null, Fireball.Size, new Vector2(0), Rand.Next(1, 6)); Mushroom current = new Mushroom(spriteSheet, Mushroom.Size, spawn, level, yat, fb, null,//sound.CreateInstance(), xpgen.New(), window); mushrooms.Add(current); if (mushrooms.Count >= maximum) { break; } } } return(mushrooms.ToArray()); }
/// <summary> /// Passes the data structure of a mushroom into the container of data. /// </summary> /// <param name="m">Data structure of the mushroom</param> public void DataToScriptable(Mushroom m) { Name = m.name; Description = m.description; Species = m.species; SetEdibleConditions(m.isEdible, m.isNotEdible, m.isRecommended, m.isPsycotropic, m.isPoisonous, m.isDangerous, m.isDeadly, m.isUnknown); }
/// <summary> /// Creates a node in Umbraco and returns the id of the new node. It returns 0 if unsuccessful. /// </summary> /// <param name="content"></param> /// <returns></returns> public async Task <int> CreateNodeAsync(Mushroom content) { string endpoint = "content/createnode"; var queryContent = new StringContent(JsonConvert.SerializeObject(content), Encoding.UTF8, "application/json"); var result = await _client.PostAsync(new Uri(ApiBase, endpoint), queryContent); if (result.IsSuccessStatusCode) { var rContent = await result.Content.ReadAsStringAsync(); if (int.TryParse(rContent, out int nodeId)) { return(nodeId); } else { Console.WriteLine("Error parsing Umbraco node id: " + rContent); return(default(int)); } } else { throw new Exception(result.ReasonPhrase); } }
public void UpdateMushroom(Mushroom updatedMushroom) { Mushroom toBeUpdated = ORM.Mushrooms.Find(updatedMushroom.MushroomID); foreach (UserMushroom userMush in ORM.UserMushrooms.Where(x => x.CommonName == toBeUpdated.CommonName).ToList()) { userMush.CommonName = updatedMushroom.CommonName; } toBeUpdated.Species = updatedMushroom.Species; toBeUpdated.CommonName = updatedMushroom.CommonName; toBeUpdated.CapChar = updatedMushroom.CapChar; toBeUpdated.NextCapChar = updatedMushroom.NextCapChar; toBeUpdated.CapColor = updatedMushroom.CapColor; toBeUpdated.Stem = updatedMushroom.Stem; toBeUpdated.StemColor = updatedMushroom.StemColor; toBeUpdated.Hymenium = updatedMushroom.Hymenium; toBeUpdated.Attachment = updatedMushroom.Attachment; toBeUpdated.HymeniumColor = updatedMushroom.HymeniumColor; toBeUpdated.SporeColor = updatedMushroom.SporeColor; toBeUpdated.CapColor = updatedMushroom.CapColor; toBeUpdated.Annulus = updatedMushroom.Annulus; toBeUpdated.Ecology = updatedMushroom.Ecology; toBeUpdated.NewEcology = updatedMushroom.NewEcology; toBeUpdated.Substrate = updatedMushroom.Substrate; toBeUpdated.GrowthPattern = updatedMushroom.GrowthPattern; toBeUpdated.NewGrowthPattern = updatedMushroom.NewGrowthPattern; ORM.Entry(toBeUpdated).State = EntityState.Modified; ORM.SaveChanges(); }
public void DestroyMushroomWhereId(int id) { Mushroom m = mushromsList.Find(x => x.ID == id); GameObject go = m.Obj; Destroy(go); }
private static async Task <Mushroom> UmbracoNodeFromContent(string cleanName) { var contentPage = await SiteScrapperService.GetContentPage(cleanName); if (contentPage == null) { throw new Exception("Site scrapper: the content page could't be found."); } TextInfo textInfo = new CultureInfo("es-ES", false).TextInfo; var cookingInterest = contentPage.GetMushroomDetailsValue("Importancia Práctica/Interés Gastronómico"); var umbracoContent = new Mushroom { Name = cleanName, Class = textInfo.ToTitleCase(contentPage.GetMushroomDetailsValue("Clase").ToLowerInvariant()), Subclass = textInfo.ToTitleCase(contentPage.GetMushroomDetailsValue("Subclase").ToLowerInvariant()), Order = textInfo.ToTitleCase(contentPage.GetMushroomDetailsValue("Orden").ToLowerInvariant()), Family = textInfo.ToTitleCase(contentPage.GetMushroomDetailsValue("Familia").ToLowerInvariant()), Synonyms = textInfo.ToTitleCase(contentPage.GetMushroomDetailsValue("Sinónimos").ToLowerInvariant().Replace("\n", "").Replace("\r", "")), Description = contentPage.GetMushroomDetailsValue("Descripción macroscópica").Replace("\n", "").Replace("\r", ""), Confusion = contentPage.GetMushroomDetailsValue("Confusiones").Replace("\n", "").Replace("\r", ""), CookingInterest = SiteScrapperService.EdibleStringToEnum(cookingInterest), PopularNames = textInfo.ToTitleCase(contentPage.GetMushroomDetailsValue("Nombres Populares").ToLowerInvariant()), CookingInstructions = contentPage.GetMushroomDetailsValue("Cocina").Replace("\n", "").Replace("\r", ""), Habitat = contentPage.GetMushroomDetailsValue("Hábitat").Replace("\n", "").Replace("\r", ""), Season = contentPage.GetMushroomDetailsValue("Temporada").Replace("\n", "").Replace("\r", ""), }; return(umbracoContent); }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _Mushroom = new Mushroom(0, 0, _level, _contentManager); _level.ToAddGameObject(_Mushroom); _level.UpdateLevel(); }
public async override Task Initialize() { await base.Initialize(); Item = (Mushroom)NavigationParameter; RaisePropertyChanged(nameof(Item)); }
public ActionResult DeleteConfirmed(int id) { Mushroom mushroom = db.Mushrooms.Find(id); db.Mushrooms.Remove(mushroom); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult SaveUpdatedMushroom(Mushroom updatedMushroom) { FungeyeDAL DAL = new FungeyeDAL(); DAL.UpdateMushroom(updatedMushroom); return(RedirectToAction("IdentifyMushrooms")); }
} //Awake void Spawn() { Mushroom mushroom = Instantiate <Mushroom>(mushroomPrefab); mushroom.gameObject.SetActive(true); Vector2 pos = new Vector2(Random.Range(left, right), Random.Range(bottom, top)); mushroom.transform.position = pos; } //Spawn
static void Main(string[] args) { Banana banaan = new Banana(); Bigmushroom bigmushroom = new Bigmushroom(); Mushroom mushroom = new Mushroom(); banaan.Throw(); bigmushroom.Grow(); mushroom.Accelerate(); }
void Start() { delayed = timeDelayedInSeconds; mushroomData = new Mushroom(mushroomId, mushroomPoints, mushroomName, this.gameObject, mushroomVolume); //prawdopodobnie do usunięcia // mushroomId = ServerMushroomController.idNext; SetCuttingTime(); animator = GetComponentInParent <Animator>(); }
public ActionResult Edit(Mushroom mushroom) { if (ModelState.IsValid) { db.Entry(mushroom).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mushroom)); }
private void OnCollisionEnter2D(Collision2D c) { Mushroom mushroom = c.gameObject.GetComponent <Mushroom>(); if (mushroom) { mushroom.Hit(1f); } Die(); }
public ProgramSession() { MainWindowButtonHandler = new MainWindowButtonHandler(); MainWindowButtonHandler.LoadDataFromXmlDocumentAction = LoadDataFromXmlDocument; MainWindowButtonHandler.GetClassOfTheMostSuitableMushroomAndDisplayMessageAction = GetClassOfTheMostSuitableMushroomAndDisplayMessage; CurrentMushroomToCompare = new Mushroom(); CurrentBasket = new Basket(); CurrentBasket.ResultantClass = "Koszyk Dziala"; CurrentBasket.ImageOK = "/SystemEkspertowyTarczykowski;component/Images/OK.png"; }
private static void PlayerPoisonedByMushroom(Mushroom mushroom, Player player) { player.PlaySound(GameSound.PlayerInjured); int r = mushroom.CalculateEnergyToRemove(player); if (r > 0) { player.ReduceEnergy(r); } mushroom.SetTaken(); }
public ActionResult Edit([Bind(Include = "Form_ID,Veg_ID,Form,Average_Retail_Price_Dollars,Price_Unit,Preparation_yield_Factor,Size_Cup_Equivalent,Size_Unit,Average_Price_Per_Cup_Dollars")] Mushroom mushroom) { if (ModelState.IsValid) { db.Entry(mushroom).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Veg_ID = new SelectList(db.Vegetables, "Veg_ID", "Veg_Name", mushroom.Veg_ID); return(View(mushroom)); }
private void MakeDistinctionBetweenMushroom(Mushroom mushroom, ref short countOfEdibleMushroom, ref short countOfInEdibleMushroom) { if (mushroom.Edibility == "Jadalny") { countOfEdibleMushroom++; } else { countOfInEdibleMushroom++; } }
public bool hasShroom(Mushroom shroom) { bool result = false; if (shroomsIntersected.Contains(shroom)) { result = true; } return(result); }
void Start() { rb = GetComponent <Rigidbody2D>(); mirrorScript = GameObject.Find("GameController").GetComponent <MirrorEffect>(); mushroomScript = GameObject.Find("GameController").GetComponent <Mushroom>(); if (isRandomised) { ItemType = (Type)Random.Range(0, System.Enum.GetValues(typeof(Type)).Length); } SetSprite(); }
public void CanAddReagent() { ReagentPouch bag = new ReagentPouch(); Mushroom shroom = new Mushroom(); bag.AddItem(shroom); Assert.AreEqual(1, bag.ItemCount); bag.DisplayContents(); }
public MushroomAI(Server server) : base(server) { Mushrooms = new List<Mushroom>(); for (int i = 0; i < Config.MushroomCount; i++) { var mushroom = new Mushroom(i, Server.Terrain) { PrevWaypoint = (i * 2) % waypoints.Length, NextWaypoint = (i * 2 + 1) % waypoints.Length }; mushroom.Position = Server.Terrain.GetHeight(waypoints[mushroom.PrevWaypoint][0]); Mushrooms.Add(mushroom); } }