protected override void OnStart() { this.animalKind = (AnimalKind)Enum.Parse(typeof(AnimalKind), PlayerDataManager.PlayerData.LastSelectedAnimalId); this.selectAnimal = this.animalKind; MakeSelectAnimal(); base.OnStart(); }
public void UpdateProperties(string name, AnimalKind kind, char sex, DateTimeOffset dateOfBirth) { Name = name; Kind = kind; Sex = sex; DateOfBirth = dateOfBirth; }
/// <summary> /// タイプしてしてアニマルカーを生成する /// </summary> public static Animal Create(AnimalKind type) { var setting = AnimalSettings.Instance[type]; var jump = (setting.jump == AnimalSettings.Jump.Short) ? Animal.JumpShort : Animal.JumpStandard; return(new Animal(setting.topSpeed, jump, setting)); }
public Pet(string name, AnimalKind kind, char sex, DateTimeOffset dateOfBirth) { Name = name; Kind = kind; Sex = sex; DateOfBirth = dateOfBirth; }
public AnimalSetting this[AnimalKind kind] { get { switch (kind) { case AnimalKind.Capybara: return(Capybara); case AnimalKind.Panda: return(Panda); case AnimalKind.Giraffe: return(Giraffe); case AnimalKind.Elephant: return(Elephant); case AnimalKind.Horse: return(Horse); case AnimalKind.Rabbit: return(Rabbit); case AnimalKind.Lion: return(Lion); case AnimalKind.Pig: return(Pig); default: throw new Exception(); } } }
public ActionResult DeleteConfirmed(int id) { AnimalKind animalKind = db.AnimalKinds.Find(id); db.AnimalKinds.Remove(animalKind); db.SaveChanges(); return(RedirectToAction("Index")); }
public UpdateAnimalKind(UpdateAnimalKindViewModel model) { vm = model; this.DataContext = vm; _animalKind = (AnimalKind)vm.GetEditableItem(); InitializeComponent(); nameTextBox.Text = _animalKind.Name; }
private void SetAnimalCount(AnimalKind kind, int count) { animals.Remove(kind); if (count > 0) { animals.Add(kind, count); } }
public Animal BuildAnimal(AnimalKind kind, int change, int lastNum, Animal mother = null) { Animal returnAnimal = new Animal(); if (mother == null) { //以标准为基准随机生成 foreach (AnimalJson animal in normalAnimals) { if (kind.ToString() == animal.Kind) { returnAnimal.编码 = (010100 + lastNum + 1).ToString("000000"); returnAnimal.种类 = kind; returnAnimal.当前状态 = CurrentState.发育中; returnAnimal.年龄 = 1; float randomHeight = Random.Range(-5.00f, +5.00f); returnAnimal.身高 = animal.Height + randomHeight; float chaZhi = 0; float randomXiong = Random.Range(-5.00f, +5.00f); returnAnimal.胸围 = returnAnimal.身高 * 0.51f + randomXiong; chaZhi += randomXiong; float randomYao = Random.Range(-5.00f, +5.00f); returnAnimal.腰围 = returnAnimal.身高 * 0.34f + randomYao; chaZhi += randomYao; float randomTun = Random.Range(-5.00f, +5.00f); returnAnimal.臀围 = returnAnimal.身高 * 0.54f + randomTun; chaZhi += randomTun; float randomWeight = Random.Range(-5.00f, +5.00f); randomWeight += chaZhi; returnAnimal.体重 = (returnAnimal.身高 - 70) * 0.6f + randomWeight; returnAnimal.寿命 = animal.Age + (int)chaZhi; int fayuChaZhi = (int)((5 - randomXiong) / 2); returnAnimal.发育期 = animal.FaYu + fayuChaZhi; int renshenChaZhi = (int)((5 - randomTun) / 2); returnAnimal.妊娠期 = animal.RenShen + renshenChaZhi; int feedChaZhi = (int)((5 - randomYao) / 2); returnAnimal.妊娠期 = Mathf.Max(1, animal.RenShen - renshenChaZhi); returnAnimal.魅力值 = Mathf.Max(30, (100 - Mathf.Abs(chaZhi) * 10)); returnAnimal.食物种类 = (FeedFood)(System.Enum.Parse(typeof(FeedFood), animal.Food)); returnAnimal.消耗食物速度 = Mathf.Max(1, (animal.Feed + (int)randomWeight / 3)); } } } return(returnAnimal); }
public void Backup(object obj, object copy) { AnimalKind kind = (AnimalKind)obj; AnimalKind cpy = (AnimalKind)copy; kind.Name = cpy.Name; kind.EatingStrategy = cpy.EatingStrategy; kind.Biome = cpy.Biome; }
protected AnimalBase(AnimalKind kind, AnimalGender gender, int ageLimit = 3) { TheWorld = World.Instance; Kind = kind; Gender = gender; _ageLimit = ageLimit; Age = 0; }
public static IAnimal GetAnimal(AnimalKind kind) { if (!repository.TryGetValue(kind, out IAnimal result)) { result = new Animal(kind); repository.Add(kind, result); } return(result); }
public UpdateAnimalKindViewModel(AnimalKind animalKind, EFDbContext context) { _animalKind = animalKind; _context = context; _animalKinds = new EFRepository <AnimalKind>(_context); UpdateAnimalKind window = new UpdateAnimalKind(this); window.ShowDialog(); }
public void CallEdit(object item) { AnimalKind animalKind = (AnimalKind)item; if (animalKind != null) { UpdateAnimalKindViewModel updateAnimalKind = new UpdateAnimalKindViewModel(animalKind, _context); Refresh(); } }
public ActionResult Edit([Bind(Include = "Id,Name")] AnimalKind animalKind) { if (ModelState.IsValid) { db.Entry(animalKind).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(animalKind)); }
public ActionResult Create([Bind(Include = "Id,Name")] AnimalKind animalKind) { if (ModelState.IsValid) { db.AnimalKinds.Add(animalKind); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(animalKind)); }
public Animal(string name, AnimalKind kind, int age, List <string> food, string color, bool hair, bool fur, bool teeth) { Name = name; Kind = kind; Age = age; Food = food; Color = color; PresenceOfHair = hair; PresenceOfFur = fur; SpecializedTeeth = teeth; }
public void OnClickToggle(Transform trn) { var tgl = trn.GetComponent <Toggle>(); if (!tgl.isOn) { return; } switch (trn.name) { case "Panda": this.selectAnimal = AnimalKind.Panda; MakeRanking(GameServer.RankingType.AnimalScore, (int)AnimalKind.Panda); break; case "Capybara": this.selectAnimal = AnimalKind.Capybara; MakeRanking(GameServer.RankingType.AnimalScore, (int)AnimalKind.Capybara); break; case "Giraffe": this.selectAnimal = AnimalKind.Giraffe; MakeRanking(GameServer.RankingType.AnimalScore, (int)AnimalKind.Giraffe); break; case "Elephant": this.selectAnimal = AnimalKind.Elephant; MakeRanking(GameServer.RankingType.AnimalScore, (int)AnimalKind.Elephant); break; case "Horse": this.selectAnimal = AnimalKind.Horse; MakeRanking(GameServer.RankingType.AnimalScore, (int)AnimalKind.Horse); break; case "Rabbit": this.selectAnimal = AnimalKind.Rabbit; MakeRanking(GameServer.RankingType.AnimalScore, (int)AnimalKind.Rabbit); break; case "Lion": this.selectAnimal = AnimalKind.Lion; MakeRanking(GameServer.RankingType.AnimalScore, (int)AnimalKind.Lion); break; case "Pig": this.selectAnimal = AnimalKind.Pig; MakeRanking(GameServer.RankingType.AnimalScore, (int)AnimalKind.Pig); break; } }
// アイテム出現率を取得 int GetRate(ItemPatternInfo.Body body, AnimalKind kind) { // アニマルカー別に拡張された確率があるか探す foreach (var extra in body.ExtraRate) { if (extra.Kind == kind) { return(extra.Rate); } } return(body.Rate); }
AnimalJson FindAnimalJsonByKind(AnimalKind kind) { AnimalJson returnJson = new AnimalJson(); foreach (AnimalJson item in normalAnimals) { if (kind.ToString() == item.Kind) { returnJson = item; } } return(returnJson); }
// アニマル解放 // 戻り値 true 解放した public bool RegistAnimal(AnimalKind kind) { if (CanUseAnimal(kind)) { return(false); } var key = kind.ToString(); this.ReleasedAnimals.Add(key); PlayerDataManager.DoUpdate(); return(true); }
public Animal CreateAnimal(AnimalKind animalType) { switch (animalType) { case AnimalKind.Dog: return(new Dog()); case AnimalKind.Cat: return(new Cat()); default: return(new Bird()); } }
// GET: AnimalKinds/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AnimalKind animalKind = db.AnimalKinds.Find(id); if (animalKind == null) { return(HttpNotFound()); } return(View(animalKind)); }
public bool AddAnimalKind(string name, EatingStrategy eatingStrategy, Biome biome) { AnimalKind kind = new AnimalKind(name, biome, eatingStrategy); _animalKinds.Create(kind); try{ _animalKinds.Save(); NotifyPropertyChanged(); return(true); } catch (DbUpdateException ex) { _animalKinds.Remove(kind); return(false); } }
// アニマルカー別BGM番号 public static BgmKind AnimalBgm(AnimalKind kind) { Dictionary <AnimalKind, BgmKind> bgm = new Dictionary <AnimalKind, BgmKind>() { { AnimalKind.Capybara, BgmKind.Animal_Capybara }, { AnimalKind.Panda, BgmKind.Animal_Panda }, { AnimalKind.Giraffe, BgmKind.Animal_Kirin }, { AnimalKind.Elephant, BgmKind.Animal_elephant }, { AnimalKind.Horse, BgmKind.Animal_Horse }, { AnimalKind.Rabbit, BgmKind.Animal_Rabbit }, { AnimalKind.Lion, BgmKind.Animal_Lion }, { AnimalKind.Pig, BgmKind.Animal_Pig } }; return(bgm[kind]); }
// プレイ後のデータ更新 public void SetResult(string area, float latitude, float longitude, AnimalKind animal, int star, float distance, int score) { Debug.Log($"Result: Map: {area} Animal: {animal.ToString()} Star: {star} Dist: {distance} Score: {score}"); // サイズが10を超えている時は先頭要素を削除 if (this.ResultHistory.Count > 10) { this.ResultHistory.RemoveAt(0); } var result = new Result() { AreaName = area, Latitude = latitude, Longitude = longitude, Animal = animal.ToString(), Star = star, Score = score, Distance = distance }; // 最後尾に追加 this.ResultHistory.Add(result); // 最後のプレイ状況 //this.LastSelectedAnimalId = animal.ToString(); this.LastPlayMapId = area; // 所持スター this.StarNum += star; // 総プレイ回数 this.TotalPlayCount += 1; // 総走行距離 this.TotalDistance += distance; // エリア履歴 RegistPlayArea(area); // ハイスコアを記録したエリア // FIXME 同じスコアだった場合の扱い if (score > this.HighScoreData.Score) { this.HighScoreData.Score = score; this.HighScoreData.MapId = area; } PlayerDataManager.DoUpdate(); }
public bool Create(object item) { AnimalKind kind = (AnimalKind)item; _animalKinds.Create(kind); try { _animalKinds.Save(); NotifyPropertyChanged(); return(true); } catch (DbUpdateException ex) { _animalKinds.Remove(kind); return(false); } }
// GET: AnimalKinds/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AnimalKind animalKind = db.AnimalKinds.Find(id); if (animalKind == null) { return(HttpNotFound()); } return(View(new AnimalKindViewModel { AnimalKind = animalKind, Breeds = db.Breeds.Where(breed => breed.AnimalKind.Id == id).ToList() })); }
public bool Update(object item) { AnimalKind kind = (AnimalKind)item; AnimalKind copy = (AnimalKind)_animalKind.Clone(); _animalKind.Name = kind.Name; _animalKind.EatingStrategy = kind.EatingStrategy; _animalKind.Biome = kind.Biome; try { _animalKinds.Update(_animalKind); _animalKinds.Save(); return(true); } catch (DbUpdateException ex) { Backup(_animalKind, copy); _animalKinds.Update(_animalKind); return(false); } }
private void AddAnimals(AnimalKind kind, int count) { int existingCount; if (kind == AnimalKind.Wolf) { if (animals.TryGetValue(AnimalKind.BigDog, out existingCount)) { SetAnimalCount(AnimalKind.BigDog, existingCount - 1); } else { //SetAnimalCount(AnimalKind.Rabbit, 0); SetAnimalCount(AnimalKind.Sheep, 0); SetAnimalCount(AnimalKind.Pig, 0); SetAnimalCount(AnimalKind.Cow, 0); SetAnimalCount(AnimalKind.SmallDog, 0); } } else if (kind == AnimalKind.Fox) { if (animals.TryGetValue(AnimalKind.SmallDog, out existingCount)) { SetAnimalCount(AnimalKind.SmallDog, existingCount - 1); } else { SetAnimalCount(AnimalKind.Rabbit, 0); } } else { animals.TryGetValue(kind, out existingCount); SetAnimalCount(kind, existingCount + (existingCount + count) / 2); } }