// Use this for initialization void Start() { apple = PlayerPrefs.GetInt("tier1", 0); cherry = PlayerPrefs.GetInt("tier2", 0); grape = PlayerPrefs.GetInt("tier3", 0); ToSpawn = Random.Range(1, 10); if (ToSpawn == 1) { Gold.SetActive(true); } if (ToSpawn == 2) { Silver.SetActive(true); } if (ToSpawn == 3 && apple == 1) { Apple.SetActive(true); } if (ToSpawn == 4 && cherry == 1) { Grape.SetActive(true); } if (ToSpawn == 5 && grape == 1) { Cherry.SetActive(true); } }
public void InterfacesInMethods() { var grape = new Grape(); var output = GetFruitName(grape); Console.WriteLine(output); }
public async Task <IActionResult> Edit(string id, [Bind("Id,Name,ApplicationUserId,CreationDate,LastModifiedDate")] Grape grape) { if (id != grape.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(grape); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GrapeExists(grape.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewBag.Categories = new SelectList(_context.Category .Where(c => c.ApplicationUserId == grape.ApplicationUserId), "Id", "Name", grape.CategoryId); return(View(grape)); }
public async Task <int> AddGrapeAsync(Grape grape) { using var uow = _uowFactory.Create(); var repo = uow.GetRepository <Grape>(); await repo.AddAsync(grape); return(await uow.SaveChangesAsync()); }
private void RemoveGrape(Grape grape) { if (grape != null) { int removed = collectedGrapes.RemoveAll(g => g == grape); Destroy(grape.gameObject); } }
public void OnTriggerEnter2D(Collider2D coll) { Grape grape = coll.gameObject.GetComponent <Grape>(); if (grape != null) { grapesActivity.CollectGrape(grape); } }
public void AddCollectedGrape(Grape grape) { if (!gameObject.activeSelf) { GameMaster.FirstGrapeCollected(); gameObject.SetActive(true); } grapeColorsPool.Add(grape.colorSpectrumValue); }
private void spawnGrapes(float[][] grapePositions) { GameObject grapePrefab = ConsumablePrefabs.Find(cons => cons.GetComponent <Consumable>().typeOfConsumable == "Grape"); for (int i = 0; i < grapePositions.Length; i++) { Grape clone = (Grape)Instantiate(grapePrefab, new Vector3(grapePositions[i][0], grapePositions[i][1], grapePositions[i][2]), Quaternion.identity).GetComponent <Grape>(); clone.setType(spawnType); clone.getPropsByType(); } }
public void InterfacesInMethods() { var grape = new Grape(); var output = GetFruitName(grape); var strawberry = new Orange(); var outputs = GetFruitName(strawberry); Console.WriteLine(output); Console.WriteLine(outputs); Assert.IsTrue(output.Contains("This fruit is called Grape")); }
public async Task <IActionResult> Create([Bind("Id,Name,ApplicationUserId,CategoryId")] Grape grape) { if (ModelState.IsValid) { _context.Add(grape); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(grape)); }
// GET: Grapes/Create public IActionResult Create() { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); ViewBag.Categories = new SelectList(_context.Category .Where(w => w.ApplicationUserId == userId), "Id", "Name", "0"); var grape = new Grape() { ApplicationUserId = userId }; return(View(grape)); }
public ActionResult Create(Grape grape) { try { _wineRepository.AddGrape(grape); _wineRepository.Save(); return(RedirectToAction("Index")); } catch { return(View()); } }
private void CheckInput() { // If manager wasn't initialized or no button was pressed, do nothing. if (!DanceMatInputManager.isInitialized || !DanceMatInputManager.GetAnyInput()) { return; } // Gets which button was pressed on current frame DanceMatInput pressedButton = GetDanceMatKeyDown(); // If the pressed button is different than the last pressed button, // increases the score if (pressedButton != lastPressedInput) { DoFootStep(); Grape closestGrape = GetClosestGrape(); if (closestGrape) { float hitRadius = ResourcesMaster.instance.hitRadius; if ((closestGrape.transform.position - target.position).sqrMagnitude < hitRadius * hitRadius) { audioSource.PlayOneShot(grapeSquashing); float resourcePerTap = ResourcesMaster.instance.resourcesPerTap; ResourcesMaster.AddResource(generatedResourceName, resourcePerTap); steppedGrapesColors.Add(closestGrape.colorSpectrumValue); if (steppedGrapesColors.Count > 10) { steppedGrapesColors.RemoveAt(0); } } else { feedbackPanel.SetAlpha(0f); feedbackPanel.DOFade(0.5f, 0.5f).From(); //float resourcePerTap = ResourcesMaster.instance.danceMatProperties.resourcesPerTap; //float usedResources = ResourcesMaster.GetResourceData(generatedResourceName).requiredToGeneratedRatio * resourcePerTap; //ResourcesMaster.RemoveRequiredResource(generatedResourceName, usedResources); } fallingGrapes.Remove(closestGrape); Destroy(closestGrape.gameObject); GameMaster.instance.collectActivity.RemoveGrapeByColor(closestGrape.colorSpectrumValue); } } // Saves current button as last pressed button for next frame. lastPressedInput = pressedButton; }
public ActionResult Delete(int id, FormCollection collection) { Grape grape = _wineRepository.FindGrapeByGrapeId(id); try { _wineRepository.DeleteGrape(grape); _wineRepository.Save(); return(RedirectToAction("Index")); } catch { return(View()); } }
public async ValueTask <ActionResult> Add([FromBody] Grape grape) { try { await _grapeService.AddGrapeAsync(grape); await _hubService.SendGrapeMessageAsync(); return(StatusCode(201, "Grape created")); } catch (Exception e) { _logger.Error("Failed to create grape.", e); return(StatusCode(500, "Server error")); } }
public ActionResult Edit(int id, FormCollection formValues) { Grape grape = _wineRepository.FindGrapeByGrapeId(id); try { UpdateModel(grape, null, null, new string[] { "GrapeId" }); _wineRepository.Save(); return(RedirectToAction("Index")); } catch { return(View(grape)); } }
public void Run() { List <IFruit> fruitSalad = new List <IFruit>(); Banana banana = new Banana(); Orange orange = new Orange(false); Grape grape = new Grape(); Grape otherGrape = new Grape(); fruitSalad.Add(banana); fruitSalad.Add(orange); fruitSalad.Add(grape); fruitSalad.Add(otherGrape); foreach (IFruit fruit in fruitSalad) { _console.WriteLine($"This is a {fruit.Name}"); _console.WriteLine(fruit.Peel()); } }
private Grape GetClosestGrape() { if (fallingGrapes.Count == 0) { return(null); } Grape closestGrape = fallingGrapes[0]; for (int i = 0; i < fallingGrapes.Count; i++) { if ((fallingGrapes[i].transform.position - target.position).sqrMagnitude < (closestGrape.transform.position - target.position).sqrMagnitude) { closestGrape = fallingGrapes[i]; } } return(closestGrape); }
private void spawnGrapes(GameObject grapePrefab) { Grape grape = grapePrefab.GetComponent <Grape>(); lastPositions = new ArrayList(); for (int i = 0; i < 6; i++) { Vector3 newFruitPosition = calculatePositionInFarms(); if (getProbabilityOf(grape.chanceOfSpawn)) { Grape clone = (Grape)Instantiate(grapePrefab, newFruitPosition, Quaternion.identity).GetComponent <Grape>(); clone.setType(spawnType); clone.getPropsByType(); numOfFruitsSpawned++; } } }
private void SpawnGrape() { float interval = ResourcesMaster.instance.beatsInterval * ResourcesMaster.instance.grapeStepMultiplier; Countdown.New(interval, SpawnGrape); if (grapeColorsPool.Count == 0) { return; } float grapeColor = grapeColorsPool.GetRandom(); Grape newGrape = Instantiate <Grape>(grapePrefab, spawnPoint.position, Quaternion.identity); newGrape.transform.SetParent(spawnPoint, true); newGrape.SetColor(grapeColor); fallingGrapes.Add(newGrape); grapeColorsPool.Remove(grapeColor); }
private void SpawnGrape() { float interval = ResourcesMaster.instance.defaultGrapesSpawnInterval * ResourcesMaster.instance.grapeSpawnMultiplier; Countdown.New(interval, SpawnGrape, false); if (grapesQueue.Count == 0) { return; } float color = grapesQueue[0]; grapesQueue.RemoveAt(0); Vector2 position = new Vector2(); position.x = Random.Range(grapeSpawnCenter.position.x - grapeSpawnArea.x / 2f, grapeSpawnCenter.position.x + grapeSpawnArea.x / 2f); position.y = Random.Range(grapeSpawnCenter.position.y - grapeSpawnArea.y / 2f, grapeSpawnCenter.position.y + grapeSpawnArea.y / 2f); Grape newGrape = Instantiate <Grape>(grapePrefab, position, grapePrefab.transform.rotation, grapeSpawnCenter); newGrape.SetColor(color); }
public void FruitTest() { Banana banana = new Banana(); Orange orange = new Orange(true); Grape grape = new Grape(); Tomato tomato = new Tomato(); orange.Peel(); Mandarin mandarin = new Mandarin(true); List <IFruit> basket = new List <IFruit>(); basket.Add(banana); basket.Add(grape); basket.Add(orange); basket.Add(mandarin); basket.Add(tomato); foreach (IFruit fruit in basket) { Console.WriteLine(fruit.Name != "grape" || fruit.Name != "tomato" ? fruit.Peel() : $"Can't peel {fruit.Name}");; } }
public void AddGrape(Grape grape) { db.Grape.InsertOnSubmit(grape); }
public void Create_Entity_Custom_Base_Success() { var person = new Grape(new GrapeId(Ulid.NewUlid())); Assert.NotNull(person); }
public void RemoveGrapeByColor(float colorValue) { Grape grape = collectedGrapes.Find(g => g.colorSpectrumValue == colorValue); RemoveGrape(grape); }
public ActionResult Edit(int id) { Grape grape = _wineRepository.FindGrapeByGrapeId(id); return(View(grape)); }
public ActionResult Create() { Grape grape = new Grape(); return(View(grape)); }
public GrapeViewModel(Grape grape) { Grape = grape; }
public void CollectGrape(Grape grape) { collectedGrapes.Add(grape); GameMaster.instance.danceMatActivity.AddCollectedGrape(grape); }
public void DeleteGrape(Grape grape) { db.Grape.DeleteOnSubmit(grape); }