public async Task DeleteCommet(int id) { Commet commet = await _context.Commets.FindAsync(id); _context.Commets.Remove(commet); await _context.SaveChangesAsync(); }
public async Task UpdateCommet(int id, CommetUpdateDto commetUpdateDto) { Commet commet = _context.Commets.Find(id); _context.Entry(commet).CurrentValues.SetValues(commetUpdateDto); await _context.SaveChangesAsync(); }
public async Task CreateCommet(CommetCreateDto commetCreateDto) { Blog blog = _context.Blogs.Find(commetCreateDto.BlogId); Commet newCommet = _mapper.Map <Commet>(commetCreateDto); await _context.Commets.AddAsync(newCommet); await _context.SaveChangesAsync(); }
private void CreateCommetForPUN(int count) { this.commets = new List <Commet> (); for (int i = 0; i < count; i++) { float y = this.GetRandomByRange(COMMET_INITIAL_POS_Y_MIN, COMMET_INITIAL_POS_Y_MAX); float initialDelta = this.GetRandomByRange(COMMET_INITIAL_DELTA_MIN, COMMET_INITIAL_DELTA_MAX); float velocity = this.GetRandomByRange(COMMET_VELOCITY_MIN, COMMET_VELOCITY_MAX); float scale = this.GetRandomByRange(COMMET_SCALE_MIN, COMMET_SCALE_MAX); GameObject obj = PhotonNetwork.Instantiate(commet.name, commet.transform.position, commet.transform.localRotation, 0); Commet c = obj.GetComponentInChildren <Commet>(); c.Init(y, initialDelta, velocity, scale); this.commets.Add(c); } }
private void CreateCommet(int count) { this.commets = new List <Commet> (); for (int i = 0; i < count; i++) { float y = this.GetRandomByRange(COMMET_INITIAL_POS_Y_MIN, COMMET_INITIAL_POS_Y_MAX); float initialDelta = this.GetRandomByRange(COMMET_INITIAL_DELTA_MIN, COMMET_INITIAL_DELTA_MAX); float velocity = this.GetRandomByRange(COMMET_VELOCITY_MIN, COMMET_VELOCITY_MAX); float scale = this.GetRandomByRange(COMMET_SCALE_MIN, COMMET_SCALE_MAX); GameObject obj = (GameObject)Instantiate(commet); Commet c = obj.GetComponentInChildren <Commet>(); c.Init(y, initialDelta, velocity, scale); this.commets.Add(c); } }