public async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Pills.Clear(); var pills = await MongoRepo.GetAllPills(); foreach (var pill in pills) { Pills.Add(pill); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
void ConsumePellet() { GameObject o = GetTileAtPosition(transform.position); //pellet object created with correct coordinates if (o != null) { Pills tile = o.GetComponent <Pills>(); //gets pill information if (tile != null) { if (!tile.Consumed && (tile.isPellet || tile.isLargePellet)) { //tile has visible pellet and is a pellet of some form o.GetComponent <SpriteRenderer>().enabled = false; //make oill invisible tile.Consumed = true; //update system GameObject temp = GameObject.Find("Game"); //get the game object. gameBoard game = temp.GetComponent <gameBoard>(); //get the game state game.score(); //score game.munch(); if (tile.isLargePellet) { GhostController.ScaredTimer = 0f; GhostController.IsScared = true; } //game.addTime(BUFFER_PILL_TIME);// WORKS AT SPEED 5 or maybe sorta (.45f*(5/speed)) //if (!temp.GetComponent<AudioSource>().isPlaying) //{ // temp.GetComponent<AudioSource>().Play(); //} } } } }
public void ConsumedBonusItem(int playerNum, Pills bonusItem) { if (playerNum == 1) { gameBoard.playerOneScore += bonusItem.pointValue; } GameObject.Find("Game").transform.GetComponent <gameBoard>().StartConsumedBonusItem(bonusItem.gameObject, bonusItem.pointValue); }
//------------------------------------------------------------------------------------------------------------ // handleCollisionPills //------------------------------------------------------------------------------------------------------------ private void handleCollisionPills(GameObject col) { _pills = col as Pills; _pills.CollectPill(); _pillCollectSound.Play(); if (_level.GetPillColect() == false) { _timer.IncreaseTime(30000); _level.SetPillColect(true); } }
public override int GetHashCode() { // Use a different bit for bool fields: bool.GetHashCode() will return 0 (false) or 1 (true). So we would // end up having the same hash code for e.g. two instances where one has only noCache set and the other // only noStore. var result = Pills.GetHashCode() ^ (FullWidth.GetHashCode() << 1) ^ (Justified.GetHashCode() << 2); // increase shift by one for every bool field result = result ^ (TabPosition.GetHashCode() ^ 1); // power of two for every other field(^1, ^2, ^4, ^8, ^16, ...) if (SelectedTab != null) { result ^= SelectedTab.GetHashCode(); } return(result); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,PillCount,PillCost,PillIngredients,Description,Milligrams")] Pills pills, IFormFile ImagePath) { if (ImagePath != null) { var fileName = Path.GetFileName(ImagePath.FileName); var path = _env.WebRootPath + "\\uploads\\productImages\\" + fileName; using (var stream = new FileStream(path, FileMode.Create)) { await ImagePath.CopyToAsync(stream); } //update song path pills.ImagePath = "uploads/productImages/" + fileName; if (id != pills.Id) { return(NotFound()); } } if (ModelState.IsValid) { try { _context.Update(pills); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PillsExists(pills.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(pills)); }
public async Task <IActionResult> Create([Bind("Id,Name,PillCount,PillCost,PillIngredients,Description,Milligrams")] Pills pills, IFormFile ImagePath) { if (ImagePath != null) { var fileName = Path.GetFileName(ImagePath.FileName); var path = _env.WebRootPath + "\\uploads\\productImages\\" + fileName; using (var stream = new FileStream(path, FileMode.Create)) { await ImagePath.CopyToAsync(stream); } //update song path pills.ImagePath = "uploads/productImages/" + fileName; } if (ModelState.IsValid) { _context.Add(pills); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(pills)); }
void ConsumePellet() { GameObject o = GetTileAtPosition(transform.position); //pellet object created with correct coordinates if (o != null) { Pills tile = o.GetComponent <Pills>(); //gets pill information if (tile != null) { if (!tile.Consumed && (tile.isPellet || tile.isLargePellet)) { //tile has visible pellet and is a pellet of some form o.GetComponent <SpriteRenderer>().enabled = false; //make oill invisible tile.Consumed = true; //update system GameObject temp = GameObject.Find("Game"); //get the game object. gameBoard game = temp.GetComponent <gameBoard>(); //get the game state game.score(); //score game.munch(); totalPellets++; if (totalPellets == allPellets) // allPellets = 191 { GhostController.canCruise = false; GetComponent <Animator>().enabled = false; GetComponent <SpriteRenderer>().sprite = nextLevel; GameObject.Find("Game").GetComponent <gameBoard>().LevelUp(); } if (totalPellets == cruisePellets) // cruisePellets = 140, after 140 pellets blinky speeds up { GhostController.canCruise = true; //GhostController.cruiseElroy(); } if (tile.isLargePellet) { if (GhostController.IsScared) { Debug.Log("Ghost # = " + ghostCounter); } else { ghostCounter = 1; } GhostController.ScaredTimer = 0f; GhostController.IsScared = true; } //game.addTime(BUFFER_PILL_TIME);// WORKS AT SPEED 5 or maybe sorta (.45f*(5/speed)) //if (!temp.GetComponent<AudioSource>().isPlaying) //{ // temp.GetComponent<AudioSource>().Play(); //} } } } }
//------------------------------------------------------------------------------------ // HandleMap //------------------------------------------------------------------------------------ private void HandleMap(int tile, int mapHeight) { if (tile - 1 < 40) { Land land = new Land(tile - 1, game.height / mapHeight, game.height / mapHeight); land.x = posX * _tileNewSize; land.y = posY * _tileNewSize; AddChild(land); } switch (tile - 1) { case 40: _player = new Player(this, game.height / mapHeight, game.height / mapHeight, _level, _timer, posX * _tileNewSize, posY * _tileNewSize); AddChild(_player); _objectList.Add(_player); _playerAnimation = new PlayerAnimation(_player, game.height / mapHeight * 2, game.height / mapHeight * 2); _playerAnimation.x = posX * _tileNewSize; _playerAnimation.y = posY * _tileNewSize; break; case 41: Box box = new Box(this, game.height / mapHeight * 2, game.height / mapHeight * 2); box.x = posX * _tileNewSize; box.y = posY * _tileNewSize; AddChild(box); _objectList.Add(box); break; case 44: Door doorYellow = new Door(tile - 1, game.height / mapHeight, game.height / mapHeight); doorYellow.x = posX * _tileNewSize; doorYellow.y = posY * _tileNewSize; AddChild(doorYellow); _doorsYellow.Add(doorYellow); break; case 46: Door doorBlue = new Door(tile - 1, game.height / mapHeight, game.height / mapHeight); doorBlue.x = posX * _tileNewSize; doorBlue.y = posY * _tileNewSize; AddChild(doorBlue); _doorsBlue.Add(doorBlue); break; case 48: Spikes syringe = new Spikes(game.height / mapHeight, game.height / mapHeight * 2, "SyringeC.png"); syringe.x = posX * _tileNewSize; syringe.y = posY * _tileNewSize; AddChild(syringe); break; case 49: _end = new EndPoint(tile - 1, game.height / mapHeight, game.height / mapHeight * 2); _end.x = posX * _tileNewSize; _end.y = posY * _tileNewSize; AddChild(_end); break; case 50: Spikes spikesUp = new Spikes(game.height / mapHeight, game.height / mapHeight, "Small_SyringeC_Top.png"); spikesUp.x = posX * _tileNewSize; spikesUp.y = posY * _tileNewSize; AddChild(spikesUp); break; case 51: Spikes spikesLeft = new Spikes(game.height / mapHeight, game.height / mapHeight, "Small_SyringeC_Right.png"); spikesLeft.x = posX * _tileNewSize; spikesLeft.y = posY * _tileNewSize; AddChild(spikesLeft); break; case 52: Spikes spikesDown = new Spikes(game.height / mapHeight, game.height / mapHeight, "Small_SyringeC_Bottom.png"); spikesDown.x = posX * _tileNewSize; spikesDown.y = posY * _tileNewSize; AddChild(spikesDown); break; case 53: Spikes spikesRight = new Spikes(game.height / mapHeight, game.height / mapHeight, "Small_SyringeC_Left.png"); spikesRight.x = posX * _tileNewSize; spikesRight.y = posY * _tileNewSize; AddChild(spikesRight); break; case 54: _buttonYellow = new Button(tile - 1, game.height / mapHeight, game.height / mapHeight); _buttonYellow.x = posX * _tileNewSize; _buttonYellow.y = posY * _tileNewSize; AddChild(_buttonYellow); break; case 56: _buttonBlue = new Button(tile - 1, game.height / mapHeight, game.height / mapHeight); _buttonBlue.x = posX * _tileNewSize; _buttonBlue.y = posY * _tileNewSize; AddChild(_buttonBlue); break; case 58: _pill = new Pills(tile - 1, game.height / mapHeight, game.height / mapHeight); _pill.x = posX * _tileNewSize; _pill.y = posY * _tileNewSize; // New Code AddChild(_pill); break; case 59: StaticEnemy virus = new StaticEnemy(game.height / mapHeight, game.height / mapHeight); virus.x = posX * _tileNewSize; virus.y = posY * _tileNewSize; AddChild(virus); break; case 60: EnemyGravity enemyGravity = new EnemyGravity(this, game.height / mapHeight, game.height / mapHeight); enemyGravity.x = posX * _tileNewSize; enemyGravity.y = posY * _tileNewSize; AddChild(enemyGravity); _objectList.Add(enemyGravity); EnemyAnimation enemyAnimation = new EnemyAnimation(enemyGravity, game.height / mapHeight, game.height / mapHeight); enemyAnimation.SetOrigin(game.height / mapHeight / 2, game.height / mapHeight / 2); enemyAnimation.x = posX * _tileNewSize; enemyAnimation.y = posY * _tileNewSize; AddChild(enemyAnimation); break; case 61: EnemyThatMoves virusHorizontal = new EnemyThatMoves(0, game.height / mapHeight, game.height / mapHeight); virusHorizontal.x = posX * _tileNewSize; virusHorizontal.y = posY * _tileNewSize; AddChild(virusHorizontal); _objectList.Add(virusHorizontal); break; case 62: EnemyThatMoves virusVertical = new EnemyThatMoves(1, game.height / mapHeight, game.height / mapHeight); virusVertical.x = posX * _tileNewSize; virusVertical.y = posY * _tileNewSize; AddChild(virusVertical); _objectList.Add(virusVertical); break; case 63: Waypoint waypointUp = new Waypoint(90, game.height / mapHeight, game.height / mapHeight, posX * _tileNewSize, posY * _tileNewSize); AddChild(waypointUp); break; } }
public static Pills <THelper> SetStacked <THelper>(this Pills <THelper> pills, bool stacked = true) where THelper : BootstrapHelper <THelper> { return(pills.ToggleCss(Css.NavStacked, stacked)); }