public void TriggerInvoke(Creature other) { if (Pair == null) { if (other.Gender == GenderType.Girl) { if (Mathf.Abs(other.Generation - Own.Generation) < Own.Params.BodyParam.DeepOfGenerationForPairing) { if (Own.CountMembersOfKind(other.Kind) < Own.Params.BodyParam.CountDiffMembersForPairing) { if (!notAvailablePair.ContainsKey(other)) { Pair = other; } else { if (Time.time - notAvailablePair[other] > 30) { notAvailablePair.Remove(other); Pair = other; } } } } } } }
protected override void GeneUpdate() { Own.RotateTo(Own.CurrentTile.ToVector3()); if (Vector3.Distance(Own.Tr.position, Own.CurrentTile.ToVector3()) > Own.Params.BodyParam.MinDistanceToAny) { Own.Behaviors.StopAction(); } float hungerDown = Own.Params.JawsParam.HungerDown; float bite = Own.Params.BodyParam.GetSize() * 0.05f; //Bite 5% from own size if (Own.CurrentTile.AgePlant < bite) { hungerDown = ((bite - Own.CurrentTile.AgePlant) / bite) * hungerDown; Own.CurrentTile.AgePlant = 0; Own.Behaviors.StopAction(); } else { Own.CurrentTile.AgePlant -= bite; if (Own.Conditions.GetContition <Hunger>().Increase(hungerDown) == 0) { Own.Behaviors.StopAction(); } } arrPlantChunks[Own.CurrentTile.X / Own.Map.sizeChunk, Own.CurrentTile.Z / Own.Map.sizeChunk].ReBuildMesh(); }
public void RedrawAll() { foreach (var item in list) { item.Redraw(); } Own.SetGrow(); }
void IStateDoubleVariables.Set(double[] input, int offset, int length) { Array.Copy(input, offset, relativePosition, 0, 3); Array.Copy(input, 3 + offset, relativeVelocity, 0, 3); Array.Copy(input, 6 + offset, relativeQuaternion, 0, 4); Array.Copy(input, 10 + offset, omega, 0, 3); Copy6DPosition(); Own.SetMatrix(); }
protected override void GeneUpdate() { if (Own.IsAlive) { GameObject.Destroy(Own.GetComponentInChildren <CreatureBar>().gameObject); Own.IsAlive = false; Own.Members.SetDeadColor(); } }
public IHttpActionResult ManageInsertOwn(Own own) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Owns.Add(own); db.SaveChanges(); return(Ok("Insert Success")); }
void IStarted.Start(double time) { Array.Copy(initialConditions, relativePosition, 3); Array.Copy(initialConditions, 3, relativeVelocity, 0, 3); Array.Copy(initialConditions, 6, relativeQuaternion, 0, 4); Array.Copy(initialConditions, 10, omega, 0, 3); Copy6DPosition(); Own.SetMatrix(); Update(); SetAliases(); }
public override void Start() { if (Own.Gender == GenderType.Boy) { particle.Play(); Pair = Own.Behaviors.GetBehavior <FindPair>().Pair; Pair.Behaviors.GetBehavior <Pairing>().Pair = Own; Pair.Behaviors.StartAction <Pairing>(); } Own.RotateTo(Pair.Tr.position); time = 0; }
public IHttpActionResult ManageUpdateOwn(Own own) { Own updatedOwn = db.Owns.FirstOrDefault(o => o.CustomerId == own.CustomerId && o.CouponId == own.CouponId); if (updatedOwn != null) { updatedOwn.IsValid = own.IsValid; db.SaveChanges(); return(Ok("更新成功!")); } return(BadRequest("请重新操作!")); }
public IHttpActionResult InsertOwn(Own data) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var session = HttpContext.Current.Request.Cookies.Get("sessionId"); if (session == null) { return(BadRequest("请先登录!")); } int customerId = CustomerSession.GetCustomerIdFromSession(int.Parse(session.Value)); if (customerId < 0) { return(BadRequest("请先登录!")); } if (db.Owns.Find(customerId, data.CouponId) == null) { Own own = new Own { CustomerId = customerId, CouponId = data.CouponId, }; db.Owns.Add(own); db.SaveChanges(); return(Ok("获取优惠券成功!")); } var updateOwn = db.Owns.FirstOrDefault(o => o.CustomerId == customerId && o.CouponId == data.CouponId); if (updateOwn != null) { updateOwn.IsValid = data.IsValid; db.SaveChanges(); return(Ok("使用成功!")); } return(BadRequest("请重新操作优惠券!")); }
void MoveTo(Vector3 next) { //Gravity(); Own.RotateTo(next); if (!Own.IsGrounded) { //Own.Rb.AddForce(Own.Tr.forward * 0.1f); } else { Own.Rb.MovePosition(Own.Tr.position + Own.Tr.forward * 0.01f); //Own.Rb.velocity = Own.Tr.forward * Own.Params.BodyParam.GetSpeed(); //Own.Tr.position+=(Own.Tr.forward * 0.0001f); } }
protected override void GeneUpdate() { if (Increase(aging) == 0) { Own.Behaviors.StartAction <Dead>(); return; } else if (Amount > repAge) { Own.Behaviors.StartAction <FindPair>(); } else if (Amount < repAge) { if (Amount % 0.1 == 0) { Own.SetGrow(); } } Bar.sizeDelta = new Vector2(Amount * 100, Bar.sizeDelta.y); }
private static Animal CreateAnimal(string[] animalParts) { string type = animalParts[0]; // • Felines - "{Type} {Name} {Weight} {LivingRegion} {Breed}"; //• Birds - "{Type} {Name} {Weight} {WingSize}"; //• Mice and Dogs - "{Type} {Name} {Weight} {LivingRegion}"; Animal animal = null; string name = animalParts[1]; double weight = double.Parse(animalParts[2]); if (type == nameof(Hen)) { animal = new Hen(name, weight, int.Parse(animalParts[3])); } else if (type == nameof(Own)) { animal = new Own(name, weight, int.Parse(animalParts[3])); } else if (type == nameof(Mouse)) { animal = new Mouse(name, weight, animalParts[3]); } else if (type == nameof(Dog)) { animal = new Dog(name, weight, animalParts[3]); } else if (type == nameof(Tiger)) { animal = new Tiger(name, weight, animalParts[3], animalParts[4]); } else if (type == nameof(Cat)) { animal = new Cat(name, weight, animalParts[3], animalParts[4]); } return(animal); }
public void SetOwned(GameObject player, GameObject owner) { int playerID = player.name.Contains("1") ? 0 : (player.name.Contains("2") ? 1 : (player.name.Contains("3") ? 2 : 3)); int ownerID = owner.name.Contains("1") ? 0 : (owner.name.Contains("2") ? 1 : (owner.name.Contains("3") ? 2 : 3)); Own own = ownedList.Find(x => x.playerID == playerID); if (own.playerID == 0 && own.ownerID == 0) { own = new Own(playerID, ownerID, null); ownedList.Add(own); } else { own.ownerID = ownerID; } if (own.overlay != null) { LevelBounds.instance.UnRegisterObject(own.overlay.GetComponentInChildren <SpriteRenderer>().gameObject); GameObject.Destroy(own.overlay); } GameObject overlay = new GameObject("Owned"); overlay.transform.parent = player.transform; overlay.transform.localPosition = new Vector2(0, 0.3f); GameObject overlayRenderer = new GameObject("OwnedRenderer"); overlayRenderer.transform.parent = overlay.transform; //overlayRenderer.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); overlayRenderer.transform.localPosition = Vector2.zero; overlayRenderer.AddComponent <SpriteRenderer>().sprite = owner.GetComponent <SpriteRenderer>().sprite; overlayRenderer.GetComponent <SpriteRenderer>().sortingOrder = player.GetComponent <SpriteRenderer>().sortingOrder; own.overlay = overlay; LevelBounds.instance.RegisterObject(overlayRenderer); }
private static void ProcessLine(BookItem book, int libraryId, int index) { try { Console.WriteLine($@"Inserting...[ISBN]:{book.Isbn}, [LibraryId]:{libraryId} , {index}번째"); // Book 테이블에 없으면 추가 if (Dao.Book.Exists(book.Isbn) == false) { Book book1 = new Book(); book1.Isbn = book.Isbn; book1.SetIsbn = book.SetIsbn; book1.Title = book.Title; book1.Author = book.Author; book1.Publisher = book.Publisher; book1.PublicationDate = book.Year; book1.Kdc = book.Kdc.Split('.')[0]; Dao.Book.Insert(book1); } // Own 테이블에 없으면 추가 if (Dao.Own.Exists(book.Isbn, libraryId) == false) { Own own = new Own(); own.Isbn = book.Isbn; own.LibraryId = libraryId; own.CopyCount = book.CopyCount; own.RentCount = book.RentCount; Dao.Own.Insert(own); } } catch (Exception ex) { Console.WriteLine(ex.Message); throw ex; } }