private HumanType GetRandomHumanType() { //Random enum get HumanType type = (HumanType)Random.Range(0, System.Enum.GetNames(typeof(HumanType)).Length); return(type); }
public ActionResult CreateHumanType(HumanTypeViewModel humanTypeViewModel) { if (!ModelState.IsValid) { return(View(humanTypeViewModel)); } else { HumanType humanType = new HumanType(); var humanLikings = new List <HumanTypeLiking>(); humanType.HumanTypeName = humanTypeViewModel.HumanTypeName; humanType.color = humanTypeViewModel.color; humanType.numberOfLocations = humanTypeViewModel.NumberOfLocations; string[] likings = humanTypeViewModel.HumanLikings.Split(' '); int[] probabilities = humanTypeViewModel.probabilities.Split(' ').Select(int.Parse).ToArray(); if (likings.Length == probabilities.Length) { for (int i = 0; i < likings.Length; i++) { humanLikings.Add(new HumanTypeLiking { humanTypeLikingName = likings[i], probability = probabilities[i] }); } humanType.humanLikings = humanLikings; context.humanTypes.AddOrUpdate(humanType); context.SaveChanges(); } else { return(View(humanTypeViewModel)); } } return(RedirectToAction("Index")); }
public Human CreateHuman(Sex sex) { Human human; var name = _helper.GetRandomName(sex); HumanType humanType = _helper.GetRandomHumanType(); switch (humanType) { case HumanType.Student: human = CreateStudent(name, sex); break; case HumanType.Botan: human = CreateBotan(name, sex); break; case HumanType.Parent: human = CreateParent(name, sex); break; case HumanType.CoolParent: human = CreateCoolParent(name, sex); break; default: throw new NotSupportedException(); } Humans.Add(human); return(human); }
private void OnIncubatorDone(Incubator incubator, HumanType humanType) { if (CurrentTask == null) { return; } if (humanTasksUI != null) { foreach (HumanTaskUI humanTaskUi in humanTasksUI) { if (humanTaskUi.Task.Type == humanType) { humanTaskUi.Done++; } } } int humanCountsInTask = CurrentTask.GetHumansList().Count; CurrentTask.HumansDone++; if (CurrentTask.HumansDone >= humanCountsInTask) { TaskDoneEvent.Invoke(CurrentTask); } }
public Human(HumanType HumanType, Vec2 Position, Vec2 Node) { this.HumanType = HumanType; this.Position = Position; this.Node = Node; this.MovementBehaviour = new UsualMovementBehaviour(); this.DecisionBehaviour = new UsualDecisionBehaviour(); }
private void Spawn(GameObject prefab, Vector3 position, Quaternion rotation, HumanType humanType, List <Transform> patrolPoints) { GameObject human = Instantiate(prefab, position, rotation); ITargetable target = human.GetComponent <ITargetable>(); target.SetHumanType(humanType); target.SetPatrolPoints(patrolPoints); }
public void UpdateUI(HumanType humanType) { AnimalButton btn = this.animalButtons.FirstOrDefault(x => x.HumanType == humanType); if (btn != null) { btn.UpdateUI(); } }
// Update is called once per frame void Update() { if (Vector3.Distance(transform.position, TargetHouse.position) < 1f && CurrentState == StateType.ComingBackHome) { CurrentState = StateType.Home; HomeSweetHome(); } if (Vector3.Distance(transform.position, TargetDest) < 1.2f) { GoToPosition(TargetHouse.position); CurrentState = StateType.ComingBackHome; } if (Vector3.Distance(transform.position, TargetFoodDest) < 1.2f && CanIgetFood && CurrentState == StateType.FoodFound) { if (TargetFood.gameObject.activeInHierarchy) { Food += TargetFood.Food; TargetFood.gameObject.SetActive(false); DidIFindFood = true; GoToPosition(TargetHouse.position); CurrentState = StateType.ComingBackHome; } else { GoToPosition(TargetDest); CurrentState = StateType.LookingForFood; } } if (Hp < 0) { if (Food == 0) { GameManagerScript.Instance.HumanBeingDied(); gameObject.SetActive(false); } else { Hp += Food; Food = 0; if (Hp > BaseHp) { Food = Hp - BaseHp; Hp = BaseHp; } } } HType = Charity > Hate && Charity > Gratitude ? HumanType.Charity : Hate > Charity && Hate > Gratitude ? HumanType.Hate : Gratitude > Hate && Charity < Gratitude ? HumanType.Gratitude : HumanType.None; //Debug.Log(Vector3.Distance(transform.position, TargetDest) + " " + name); }
void ChangeBodySkin(HumanType type) { int Data_BodyType = (int)DataController.Instance.saveable.body; humanObj[(int)type].GetComponent <MeshRenderer>().material.mainTexture = DataController.Instance.playerbody[Data_BodyType].playerBodyInfo[(int)type - 1].texture; humanObj[(int)type].GetComponent <MeshFilter>().mesh = DataController.Instance.playerbody[Data_BodyType].playerBodyInfo[(int)type - 1].mesh; var Data_XYZ = DataController.Instance.playerbody[Data_BodyType].playerBodyInfo[(int)type - 1].xyz; humanObj[(int)type].transform.localPosition = new Vector3(Data_XYZ.x, Data_XYZ.y, Data_XYZ.z); humanObj[(int)type].gameObject.SetActive(DataController.Instance.playerbody[Data_BodyType].playerBodyInfo[(int)type - 1].isExists); }
public float GetGrowTime(HumanType type) { foreach (HumanGrowTime item in GrowTimes) { if (item.Type == type) { return(item.Time); } } return(0); }
public float GetPrecision(HumanType type) { foreach (HumanPrecision item in Precisions) { if (item.Type == type) { return(item.Precision); } } return(0.5f); }
public Color GetHumanColor(HumanType type) { foreach (HumanColor item in HumanColors) { if (item.Type == type) { return(item.Color); } } return(Color.blue); }
public Human(GeneticCode code) { this.code = code; type = HumanType.Child; firstUpdate = true; secondsUntilMaturity = 5f + (Random.value * 10f); state = HumanState.Idle; setFuel(200); addBehaviours(); updateWeights(); World.world.updateHumanState(getID()); }
public static void SpawnHuman_Postfix(HumanManager __instance, ref HumanAI __result, HumanConfiguration config, Vector3 position, Faction faction, bool alive = true, HumanAI.Serializable serial = null) { if (UIImprovementsMod.Instance == null || UIImprovementsMod.Instance.AnimalCyclerPanel == null) { return; } if (__result != null && __result.faction != null && !__result.IsHumanoid() && __result.animal != null && __result.faction is ColonyFaction) { HumanType type = __result.humanType; UIImprovementsMod.Instance.AnimalCyclerPanel.UpdateUI(type); } }
public override IHuman GetHuman(HumanType humanType) { switch (humanType) { case HumanType.Chevalier: return(new Chevalier()); case HumanType.Fighter: return(new Fighter()); case HumanType.Warrior: return(new Warrior()); } return(null); }
public void HaveIdAndNameFields() { //Given var characterRepository = new Mock <ICharacterRepository>(); // When var humanType = new HumanType(characterRepository.Object); // Then Assert.NotNull(humanType); Assert.True(humanType.HasField("Id")); Assert.Equal(typeof(NonNullGraphType <IntGraphType>), humanType.GetField("Id").Type); Assert.True(humanType.HasField("Name")); Assert.True(humanType.HasField("Friends")); Assert.True(humanType.HasField("AppearsIn")); }
public override IHuman GetHuman(HumanType humanType) { switch (humanType) { case HumanType.Beggar: IHuman beggar = new Beggar(); return(beggar); case HumanType.Farmer: IHuman farmer = new Farmer(); return(farmer); case HumanType.Shopowner: IHuman shopowner = new Shopowner(); return(shopowner); } return(null); }
public override IHuman GetHuman(HumanType humanType) { switch (humanType) { case HumanType.FratBoi: IHuman FratBoi = new FratBoi(); return(FratBoi); case HumanType.Farmer: IHuman farmer = new Farmer(); return(farmer); case HumanType.Shopowner: IHuman shopowner = new Shopowner(); return(shopowner); } return(null); }
//Sets up a default human void Awake() { Debug.Log("Fully Awake"); entityType = new HumanType(); entityNeeds = new HumanNeeds(); psyche = new HumanPsyche(); currentlyBusy = false; avatar = GetComponent <DynamicCharacterAvatar>(); dnaHolder = new Dictionary <string, DnaSetter>(); HUMANROOT = null; nextUpdate = 0.0f; WORLDTIME = GameObject.Find("WorldTime").GetComponent <WorldTime>(); lastUpdate = WORLDTIME.WORLDTIME; updateRequired = true; HUMANROOT = gameObject; navAgent = gameObject.AddComponent <NavMeshAgent>(); }
public HumanResponse(HumanType Type, Human Human) { IsSuccess = true; Id = Human.Id; Name = Human.Name; Age = Human.Age; switch (Type) { case HumanType.Male: Job = ((Male)Human).Job; break; case HumanType.Shemale: ChildrensCount = ((Shemale)Human).ChildrensCount; break; default: break; } }
public override IHuman GetHuman(HumanType type) { switch (type) { case HumanType.Beggar: IHuman beggar = new Beggar(); return(beggar); case HumanType.Farmer: IHuman farmer = new Farmer(); return(farmer); case HumanType.Trader: IHuman trader = new Trader(); return(trader); default: break; } return(null); }
public Human GetHuman(HumanType Type) { switch (Type) { default: case HumanType.Male: return(new Male { Id = 777, Age = 25, Name = "Vadym", Job = ".Net Developer" }); case HumanType.Shemale: return(new Shemale { Id = 666, Name = "B2", Age = 27, ChildrensCount = -1 }); } }
//Loads a human public void loadHuman(HumanSave load) { gameObject.name = load.Name; Debug.Log(load.Name); gameObject.layer = load.layer; gameObject.tag = load.tag; Debug.Log("Fully loaded"); //Load Human and inherited Entity class type = load.type; entityController = new EntityTaskController(load); lastUpdate = load.lastUpdate; entityType = new HumanType(load); entityNeeds = new HumanNeeds(load); psyche = new HumanPsyche(load); recipe = load.recipe; avatar.LoadFromRecipeString(recipe); //recipe = load.recipe; navAgent.Warp(new Vector3(load.xloc, load.yloc, load.zloc)); //gameObject.transform.position = new Vector3(load.xloc, load.yloc, load.zloc); gameObject.transform.localEulerAngles = new Vector3(load.xrot, load.yrot, load.zrot); }
public Human(HumanType type) { this.type = type; this.position = Position.Source; }
public override void update(float deltaTime, List <Boid> neighbors, List <Boid> touching) { HumanType initialType = type; HumanState initialState = state; bool seesZombie = false; for (int i = 0; i < neighbors.Count; i++) { if (neighbors[i].getFaction() == "Zombie") { state = HumanState.Hunted; seesZombie = true; } } if (seesZombie == false) { state = HumanState.Idle; } for (int i = 0; i < touching.Count; i++) { if (touching[i].getFaction() == "Food") { addFuel(touching[i].getFuel()); World.world.removeFood(touching[i].getID()); } else if (type == HumanType.Female && touching[i].getFaction() == "Male") { //Become pregnant type = HumanType.PregnantFemale; childCode = new GeneticCode(touching[i].getGeneticCode(), code, 0.05f); secondsUntilBirth = 7f; } } if (getFuel() < 0) { World.world.killHuman(getID()); return; } else if (getFuel() < 50) { state = HumanState.Hungry; } if (type == HumanType.PregnantFemale) { secondsUntilBirth -= deltaTime; if (secondsUntilBirth < 0) { //Give birth World.world.spawnChild(getID(), getPosition(), childCode); type = HumanType.Female; } } else if (type == HumanType.Child) { secondsUntilMaturity -= deltaTime; if (secondsUntilMaturity < 0) { //Become an adult if (Random.value < 0.5f) { type = HumanType.Male; } else { type = HumanType.Female; } } } secondsAlive += deltaTime; if (firstUpdate || initialState != state || initialType != type) { firstUpdate = false; updateWeights(); World.world.updateHumanState(getID()); } return; }
public override IHuman GetHuman(HumanType humanType) { return(null); }
static void Main() { HumanType gosho = new HumanType(); gosho.CreateHuman(123421); }
public static Image GetHumanIcon(HumanType humanType) { Image icon = allIcons.Find(ahi => ahi.HumanType.Equals(humanType)).HumanIcon; return(icon == null ? null : icon); }
public HumanRequest(string SecretKet, HumanType Type) { this.SecretKet = SecretKet; this.Type = Type; }
public abstract IHuman GetHuman(HumanType humanType);
public void SetHumanType(HumanType humanType) { HumanType = humanType; }