public BoardObj(CardDB.cardName cName, int lvl = 0) { CardDB.Card c = CardDB.Instance.getCardDataFromName(cName, lvl); this.card = c; this.Name = c.name; this.type = c.type; this.Transport = c.Transport; this.affectOn = c.affectType; this.cost = c.cost; this.DeployTime = c.DeployTime; this.DamageRadius = c.DamageRadius; this.MaxHP = c.MaxHP; this.HP = c.MaxHP; this.Atk = c.Atk; this.Shield = c.Shield; this.Speed = c.Speed; this.HitSpeed = c.HitSpeed; this.MinRange = c.MinRange; this.Range = c.MaxRange; this.SightRange = c.SightRange; this.TargetType = c.TargetType; this.MaxTargets = c.MultipleTargets; this.LifeTime = c.LifeTime; this.SpawnNumber = c.SpawnNumber; this.SpawnInterval = c.SpawnInterval; this.SpawnTime = c.SpawnPause; this.SpawnCharacterLevel = c.SpawnCharacterLevel; this.DeathEffect = c.DeathEffect; this.level = lvl; //this.Tower = c.Tower; }
//Clears The animat targeting variables void clearPrioritys() { hasTask = false; target = null; hasTarget = false; currentTargetType = targetType.Water; currentState = State.Idle; }
// if player leaves collision range of current target, deselect current target void OnTriggerExit(Collider other) { // if current target is the collider player is exiting if (currentTarget = other.gameObject) { // deselect it as the target currentTarget = null; playerTarget = targetType.None; print("Current Target: " + currentTarget); } }
/* * //////////////////// * Decision update block * //////////////////// */ void Update() { if (health > startingHealth / 2 && isGrazing != true) { currentTargetType = targetType.Mob; priorityTarget = combatTarget[combatPreference]; } else { currentTargetType = targetType.Terra; priorityTarget = grazeTarget[grazingPreference]; } if (hasTarget && currentState != State.Idle) { if (Time.time > nextAttackTime && target != null) { float sqrDstToTarget = (target.position - transform.position).sqrMagnitude; if (sqrDstToTarget < Mathf.Pow(attackDistanceThreshold + thisColissionRadius + targetColissionRadius, 2)) { nextAttackTime = Time.time + timeBetweenAttacks; if (currentTargetType == targetType.Terra && targetTerrain != null) { if (targetTerrain.HasReasource() == true) { StartCoroutine(Attack()); } else { targetTerrain = null; target = null; hasTarget = false; currentState = State.Idle; } } else if (currentTargetType == targetType.Mob) { StartCoroutine(Attack()); } else { StartSearch(); } } } } else { if (priorityTarget != null && currentState == State.Idle && dead != true) { StartSearch(); } } }
private Transform holdingArea; // child transform for players that tracks holding item position void Start() { controller = GetComponent <CharacterController>(); anim = gameObject.GetComponentInChildren <Animator>(); hInput = "Horizontal_" + playerID; // allows for reuse of script for multiple players vInput = "Vertical_" + playerID; fire1Input = "Fire1_" + playerID; fire2Input = "Fire2_" + playerID; isWorking = false; playerTarget = targetType.None; holdingArea = transform.Find("HoldingArea"); }
//Clears Prioritys if the target being chased dies void OntargetDeath() { if (dead != true) { spawnOrigin.AddData(1); //Debug.Log(tag + "Killed a creature"); hasTask = true; priorityTarget = consumeTarget[3]; currentTargetType = targetType.Essence; currentState = State.Seaking; StartSearch(); } }
private void SetStopDistance() { if (target.gameObject.name.Contains("Castle")) { currentTargetType = targetType.castle; stopDistance = 2f; } else { currentTargetType = targetType.normal; stopDistance = 0.7f; } }
void SetRandomType() { // Assign random target type int random = Random.Range(0, 2); if (targetType.IsDefined(typeof(targetType), random)) // check if random number is within enum scope { type = (targetType)random; } else { Debug.LogError("Random number outside of targetType enum scope"); } }
internal void finish(int order, targetType resultType, double resultValue) { dataSource.stop(); dataSource.isInUse = false; //round the value to 0.1s since our update resolution from most data sources is at least 250ms finishResult = Math.Round(resultValue, 1); //Display finish racePanel.Dispatcher.Invoke(new Action(() => { racePanel.finishRace(); racePanel.makeAnnouncement(String.Format("Finished! - {0:0.0} {1}", finishResult, resultType)); })); }
void SetCurrentTargetItem(Collider other) { // if currently holding an object, only target processors if (carriedItem) { if (!currentTarget) { processorExists = other.gameObject.GetComponent <Processor>(); if (processorExists) { currentTarget = other.gameObject; playerTarget = targetType.Processor; print("Current Target: " + currentTarget); } } } // if currently not targeting anything else if (!currentTarget) { // check if object player collides with is able to be picked up pickUpItemExists = other.gameObject.GetComponent <PickUpItem>(); dispenserExists = other.gameObject.GetComponent <Dispenser>(); processorExists = null; // if not holding anything, target cannot be processor // if it is, set is as the current target if (pickUpItemExists) { if (!pickUpItemExists.GetHeldStatus()) // if item to be picked up is not currently being held by another player { currentTarget = other.gameObject; // set as current target playerTarget = targetType.Item; print("Current Target: " + currentTarget); } } else if (dispenserExists) { // if not check if it is a dispenser currentTarget = other.gameObject; // set dispensed item as current target playerTarget = targetType.Dispenser; print("Current Target: " + currentTarget); } else { // otherwise, do nothing } } else { } // if player already has a target, do nothing }
//Invokes the animat to return to its spawner of origin public void Nest() { if (dead != true) { StopAllCoroutines(); FixLocation(); clearPrioritys(); hasTask = true; target = spawnOrigin.transform; currentState = State.Nesting; currentTargetType = targetType.Spawner; clearPrioritys(); metabolicRate = (int)(0.75f * metabolicRate); Debug.Log(gameObject.name + " is Docking"); spawnOrigin.Dock(this); } }
public BoardObj(BoardObj bo) { this.Name = bo.Name; this.card = bo.card; this.type = bo.type; this.Transport = bo.Transport; this.affectOn = bo.affectOn; this.Position = bo.Position; this.own = bo.own; this.pID = bo.pID; //-???????? this.Line = bo.Line; this.GId = bo.GId; this.cost = bo.cost; this.DeployTime = bo.DeployTime; this.DamageRadius = bo.DamageRadius; this.MaxHP = bo.MaxHP; this.HP = bo.HP; this.Atk = bo.Atk; this.Shield = bo.Shield; this.Speed = bo.Speed; this.HitSpeed = bo.HitSpeed; this.MinRange = bo.MinRange; this.Range = bo.Range; this.SightRange = bo.SightRange; this.TargetType = bo.TargetType; this.MaxTargets = bo.MaxTargets; this.attacking = bo.attacking; this.attacked = bo.attacked; this.LifeTime = bo.LifeTime; this.SpawnNumber = bo.SpawnNumber; this.SpawnInterval = bo.SpawnInterval; this.SpawnTime = bo.SpawnTime; this.SpawnCharacterLevel = bo.SpawnCharacterLevel; this.frozen = bo.frozen; this.clone = bo.clone; this.startFrozen = bo.startFrozen; this.attacker = bo.attacker; this.target = bo.target; this.DeathEffect = bo.DeathEffect; this.Tower = bo.Tower; this.extraData = bo.extraData; }
public BoardObj(CardDB.cardName cName, int lvl = 0) { CardDB.Card c = CardDB.Instance.getCardDataFromName(cName, lvl); this.card = c; this.Name = c.name; this.type = c.type; this.Transport = c.Transport; this.affectOn = c.affectType; //this.Position = c.Position; //this.own = c.own; //this.pID = c.pID; //-???????? //this.Line = c.Line; //this.GId = c.GId; this.cost = c.cost; this.DeployTime = c.DeployTime; this.DamageRadius = c.DamageRadius; this.MaxHP = c.MaxHP; this.HP = c.MaxHP; this.Atk = c.Atk; this.Shield = c.Shield; this.Speed = c.Speed; this.HitSpeed = c.HitSpeed; this.MinRange = c.MinRange; this.Range = c.MaxRange; this.SightRange = c.SightRange; this.TargetType = c.TargetType; this.MaxTargets = c.MultipleTargets; //this.attacking = c.attacking; //this.attacked = c.attacked; this.LifeTime = c.LifeTime; this.SpawnNumber = c.SpawnNumber; this.SpawnInterval = c.SpawnInterval; this.SpawnTime = c.SpawnPause; this.SpawnCharacterLevel = c.SpawnCharacterLevel; //this.frozen = c.frozen; //this.startFrozen = c.startFrozen; //this.attacker = c.attacker; //this.target = c.target; this.DeathEffect = c.DeathEffect; //this.Tower = c.Tower; }
public RaceDetails(List <RacerDetails> racerList, targetType targetType) { //Note: Some of the framework was set up to handle races with a timed target, // but as development progressed, only distance races were implemented. Enabling timed // races would require a thorough code review. if (targetType != AntPlusRacer.targetType.Meters) { throw new NotImplementedException("Support for timed races is disabled! See notes in code."); } racerDetails = racerList.ToList(); this.target_type = targetType; raceTock = new System.Timers.Timer(750); raceTock.Elapsed += new System.Timers.ElapsedEventHandler(raceTock_Elapsed); if (target_type == targetType.Meters) { raceTimer = new System.Diagnostics.Stopwatch(); } }
public Handcard getCheapestCard(boardObjType type, targetType tgtType) { Handcard retval = null; List <Handcard> tmp = new List <Handcard>(); foreach (Handcard hc in ownHandCards) { if ((hc.card.type == type || type == boardObjType.NONE) && (hc.card.TargetType == targetType.NONE || hc.card.TargetType == tgtType)) { tmp.Add(hc); } } foreach (Handcard hc in tmp) { if (retval == null || hc.card.cost < retval.card.cost) { retval = hc; } } return(retval); }
if (ReferenceEquals(targetType, LanguageConstants.String))
LdcI4(compilation, 0).ConvertTo(targetType, expressionBuilder, checkForOverflow) ).WithoutILInstruction().WithRR(new ResolveResult(targetType)));
LdcI4(compilation, 1).ConvertTo(targetType, expressionBuilder, checkForOverflow),
//Initilization protected override void Start() { //start living entity base class base.Start(); startingHealth = baseHealth; switch (dietinfo) { case 'h': dietType = Diet.Herbivorous; break; case 'o': dietType = Diet.Omnivorous; break; case 'p': dietType = Diet.Carnivorous; break; } //Action marker setup skinDefalt = GetComponent<Renderer>().material; defaltColor = skinDefalt.color; //navagation set up pathfinder = GetComponent<NavMeshAgent>(); pathfinder.acceleration = acceleration; pathfinder.speed = movmentSpeed; currentState = State.Idle; currentTargetList = new List<Transform>(); currentTargetType = targetType.Water; //Combat set up animatCombat = GetComponent<Combat>(); attackDistanceThreshold = attackRange / 1.2f; animatCombat.SetStats(attackRange, attackAccuracy, attackDamage); //Sence Components set up //sight animatSight = GetComponent<Sight>(); animatSight.SetStats(sightRange); //olfaction animatOlfaction = GetComponent<Olfaction>(); animatOlfaction.SetStats(olfactionRange, olfactionAccuracy); //audition animatAudition = GetComponent<Audition>(); animatAudition.SetStats(hearingRange); //Metabolism hunger = (int)(baseSatation/1.5); thirst = (int)(baseHydration/1.5); StartCoroutine(Metabolism()); //Cognition spawnOrigin = GetComponentInParent<Spawner>(); noOfTargetsConsumed = 0; StartCoroutine(DecisionBlock()); StartCoroutine(ActionBlock()); }
//Initilization protected override void Start() { //start living entity base class base.Start(); startingHealth = baseHealth; switch (dietinfo) { case 'h': dietType = Diet.Herbivorous; break; case 'o': dietType = Diet.Omnivorous; break; case 'p': dietType = Diet.Carnivorous; break; } //Action marker setup skinDefalt = GetComponent <Renderer>().material; defaltColor = skinDefalt.color; //navagation set up pathfinder = GetComponent <NavMeshAgent>(); pathfinder.acceleration = acceleration; pathfinder.speed = movmentSpeed; currentState = State.Idle; currentTargetList = new List <Transform>(); currentTargetType = targetType.Water; //Combat set up animatCombat = GetComponent <Combat>(); attackDistanceThreshold = attackRange / 1.2f; animatCombat.SetStats(attackRange, attackAccuracy, attackDamage); //Sence Components set up //sight animatSight = GetComponent <Sight>(); animatSight.SetStats(sightRange); //olfaction animatOlfaction = GetComponent <Olfaction>(); animatOlfaction.SetStats(olfactionRange, olfactionAccuracy); //audition animatAudition = GetComponent <Audition>(); animatAudition.SetStats(hearingRange); //Metabolism hunger = (int)(baseSatation / 1.5); thirst = (int)(baseHydration / 1.5); StartCoroutine(Metabolism()); //Cognition spawnOrigin = GetComponentInParent <Spawner>(); noOfTargetsConsumed = 0; StartCoroutine(DecisionBlock()); StartCoroutine(ActionBlock()); }
TypeKind.Interface => new InterfaceMethodGenerator(targetType, methodPrefix),
/* //////////////////// Decision update block //////////////////// */ void Update() { if (health > startingHealth/2 && isGrazing != true) { currentTargetType = targetType.Mob; priorityTarget = combatTarget[combatPreference]; } else { currentTargetType = targetType.Terra; priorityTarget = grazeTarget[grazingPreference]; } if (hasTarget && currentState != State.Idle) { if (Time.time > nextAttackTime && target != null) { float sqrDstToTarget = (target.position - transform.position).sqrMagnitude; if (sqrDstToTarget < Mathf.Pow(attackDistanceThreshold + thisColissionRadius + targetColissionRadius, 2)) { nextAttackTime = Time.time + timeBetweenAttacks; if (currentTargetType == targetType.Terra && targetTerrain != null) { if (targetTerrain.HasReasource() == true) { StartCoroutine(Attack()); } else { targetTerrain = null; target = null; hasTarget = false; currentState = State.Idle; } } else if (currentTargetType == targetType.Mob) { StartCoroutine(Attack()); } else { StartSearch(); } } } } else { if (priorityTarget != null && currentState == State.Idle && dead != true) { StartSearch(); } } }
//Clears Prioritys if the target being chased dies void OntargetDeath() { if (dead != true) { spawnOrigin.AddData(1); //Debug.Log(tag + "Killed a creature"); hasTask = true; priorityTarget = consumeTarget[3]; currentTargetType = targetType.Essence; currentState = State.Seaking; StartSearch(); } }
//Clears The animat targeting variables void clearPrioritys() { hasTask = false; target = null; hasTarget = false; currentTargetType = targetType.Water; currentState = State.Idle; }
// Looks at the Animate State, Vital Componnets and Possible targets and determins the action the animat takes IEnumerator DecisionBlock() { bool targetPreferenceFound; List<Transform> possibleTargets; while (dead != true) { switch (currentState) { //Determines the next priority target case State.Idle: if (noOfTargetsConsumed >= 4) { animatCombat.FertilizeSoil(); spawnOrigin.AddData(3); } possibleTargets = animatOlfaction.Sniff(); targetPreferenceFound = false; switch (dietType) { case Diet.Herbivorous: if (thirst < baseHydration / 2) { priorityTarget = consumeTarget[2]; currentTargetType = targetType.Water; StartSearch(); } else if (hunger < baseSatation / 2) { priorityTarget = consumeTarget[0]; currentTargetType = targetType.Terra; StartSearch(); } else if (thirst < baseHydration / 1.2) { priorityTarget = consumeTarget[2]; currentTargetType = targetType.Water; StartSearch(); } else if (hunger < baseSatation / 1.2) { priorityTarget = consumeTarget[0]; currentTargetType = targetType.Terra; StartSearch(); } else if (hunger < baseSatation / 1.1f) { if (possibleTargets != null) { foreach (Transform posibleTarget in possibleTargets) { if (posibleTarget.GetComponentInParent<PrimaryProducer>() == true) { priorityTarget = consumeTarget[1]; currentTargetType = targetType.Flora; StartSearch(); targetPreferenceFound = true; break; } } } if (targetPreferenceFound != true) { priorityTarget = consumeTarget[0]; currentTargetType = targetType.Terra; StartSearch(); } } break; case Diet.Carnivorous: if (thirst < baseHydration / 3) { priorityTarget = consumeTarget[2]; currentTargetType = targetType.Water; StartSearch(); } else { if (possibleTargets != null) { foreach (Transform posibleTarget in possibleTargets) { if (posibleTarget.GetComponent<AnimatEssence>() == true) { //Debug.Log("Essence in proximity"); priorityTarget = consumeTarget[3]; currentTargetType = targetType.Essence; StartSearch(); targetPreferenceFound = true; break; } } } if (targetPreferenceFound != true && hunger < baseSatation/2) { priorityTarget = combatTarget; currentTargetType = targetType.Mob; StartSearch(); } } break; case Diet.Omnivorous: if (thirst < baseHydration / 2) { priorityTarget = consumeTarget[2]; currentTargetType = targetType.Water; StartSearch(); } else if (hunger < baseSatation / 3) { priorityTarget = consumeTarget[0]; currentTargetType = targetType.Terra; StartSearch(); } else if (hunger < baseSatation / 1.1) { if (possibleTargets != null) { foreach (Transform posibleTarget in possibleTargets) { if (posibleTarget.GetComponent<AnimatEssence>() == true) { priorityTarget = consumeTarget[3]; currentTargetType = targetType.Essence; StartSearch(); targetPreferenceFound = true; break; } } if (targetPreferenceFound != true) { foreach (Transform posibleTarget in possibleTargets) { if (posibleTarget.GetComponentInParent<PrimaryProducer>() == true) { priorityTarget = consumeTarget[1]; currentTargetType = targetType.Flora; StartSearch(); targetPreferenceFound = true; break; } } } } } break; } break; case State.Chasing: break; case State.Seaking: if ((thirst == baseHydration && currentTargetType == targetType.Water) || (hunger == baseSatation && currentTargetType == targetType.Terra)) { clearPrioritys(); } break; case State.Grazing: if ((thirst > baseHydration / 1.01 && currentTargetType == targetType.Water) || (hunger > baseSatation / 1.01 && currentTargetType == targetType.Terra) || hunger == baseSatation && currentTargetType == targetType.Essence) { clearPrioritys(); } break; case State.Nesting: Nest(); break; default: break; } yield return new WaitForSeconds(0.25f); } }
TryGetCharaPosWithInCell(level, srcPos, targetType, cellNum, param, out var targetPos);
//-----------------------------Battle------------------------------------------ IEnumerator PerformPlayerMove(int moveNumber) { state = BattleState.Busy; var move = moveSet.getCurrentMoves()[moveNumber]; audioSource.PlayOneShot(move.getMoveBase().getAudio()); dialogueBox.ActivateDialogue(); //------------------------Player Move------------------------------- targetType moveType = move.getMoveBase().getTargetType(); if (moveType == targetType.Enemy) { player.PlayZoomInAnimation(ghostTarget[currentChooseTarget].GetPosition()); ghostTarget[currentChooseTarget].PlayHitAnimation(); int dmg = ghostTarget[currentChooseTarget].Ghost.TakeDmg(move.getMoveBase()); ghostTarget[currentChooseTarget].GetComponent <BattleHud>().UpdateUI(ghostTarget[currentChooseTarget].Ghost); if (move.getMoveBase().getMoveName() != "Attack") { yield return(dialogueBox.TypeDialogue($"Dara menggunakan {move.getMoveBase().getMoveName()} sebanyak {dmg.ToString()} Damage")); } else { yield return(dialogueBox.TypeDialogue($"Dara menyerang musuh sebanyak {dmg.ToString()} Damage")); } player.PlayZoomOutAnimation(); } if (moveType == targetType.Aoe) { int dmg = 0; for (int i = 0; i < ghostTarget.Count; i++) { ghostTarget[i].PlayHitAnimation(); dmg = ghostTarget[i].Ghost.TakeDmg(move.getMoveBase()); ghostTarget[i].GetComponent <BattleHud>().UpdateUI(ghostTarget[i].Ghost); } yield return(dialogueBox.TypeDialogue("Dara menyerang semua musuh")); } if (moveType == targetType.Self) { //heal persen var heal = (move.getMoveBase().getBaseDmg() * PlayerStat.maxHealth) / 100; PlayerStat.health += (int)heal; if (PlayerStat.health >= PlayerStat.maxHealth) { PlayerStat.health = PlayerStat.maxHealth; } yield return(dialogueBox.TypeDialogue($"Dara memulihkan {heal.ToString()} HP")); } //------------------------Player Move------------------------------- var moveBase = moveSet.getCurrentMoves()[moveNumber].getMoveBase(); player.MinusCost(moveBase); List <bool> deadGhostIndex = new List <bool>(); for (int i = 0; i < ghostTarget.Count; i++) { bool status = false; if (ghostTarget[i].Ghost.HP <= 0) { status = true; } deadGhostIndex.Add(status); } for (int i = 0; i < deadGhostIndex.Count; i++) { if (deadGhostIndex[i] == true) { dialogueBox.ActivateDialogue(); yield return(dialogueBox.TypeDialogue($"{ghostTarget[i].Ghost.Base.getName()} berhasil ditaklukan")); yield return(DeadEnemies(i)); deadGhostIndex.RemoveAt(i); i = 0; } } yield return(new WaitForSeconds(waitDialogue)); StartCoroutine(EnemyMove()); }
_ => new InvalidParentMethodGenerator(targetType, location)
public void setType(targetType type) { this.type = type; }
void newTarget() { newtargetactive = true; if (TargetType == targetType.Building) { GameObject spawn; spawn = target.gameObject; Instantiate(log, new Vector3(spawn.transform.position.x + 3, spawn.transform.position.y + 3,spawn.transform.position.z), spawn.transform.rotation); Inventory.Remove(Inventory[0]); target = null; } if (TargetType == targetType.Tree) { Destroy(target.gameObject); Inventory.Add(log); target = StoredLocations[0]; TargetType = targetType.Building; AstarPath.active.Scan(); } if (target) { Seeker seeker = GetComponent<Seeker>(); Debug.Log("Done"); seeker.StartPath(transform.position, target.transform.position, OnPathComplete); newtargetactive = false; } }
//Invokes the animat to return to its spawner of origin public void Nest() { if (dead != true) { StopAllCoroutines(); FixLocation(); clearPrioritys(); hasTask = true; target = spawnOrigin.transform; currentState = State.Nesting; currentTargetType = targetType.Spawner; clearPrioritys(); metabolicRate = (int)(0.75f * metabolicRate); Debug.Log(gameObject.name + " is Docking"); spawnOrigin.Dock(this); } }
// Looks at the Animate State, Vital Componnets and Possible targets and determins the action the animat takes IEnumerator DecisionBlock() { bool targetPreferenceFound; List <Transform> possibleTargets; while (dead != true) { switch (currentState) { //Determines the next priority target case State.Idle: if (noOfTargetsConsumed >= 4) { animatCombat.FertilizeSoil(); spawnOrigin.AddData(3); } possibleTargets = animatOlfaction.Sniff(); targetPreferenceFound = false; switch (dietType) { case Diet.Herbivorous: if (thirst < baseHydration / 2) { priorityTarget = consumeTarget[2]; currentTargetType = targetType.Water; StartSearch(); } else if (hunger < baseSatation / 2) { priorityTarget = consumeTarget[0]; currentTargetType = targetType.Terra; StartSearch(); } else if (thirst < baseHydration / 1.2) { priorityTarget = consumeTarget[2]; currentTargetType = targetType.Water; StartSearch(); } else if (hunger < baseSatation / 1.2) { priorityTarget = consumeTarget[0]; currentTargetType = targetType.Terra; StartSearch(); } else if (hunger < baseSatation / 1.1f) { if (possibleTargets != null) { foreach (Transform posibleTarget in possibleTargets) { if (posibleTarget.GetComponentInParent <PrimaryProducer>() == true) { priorityTarget = consumeTarget[1]; currentTargetType = targetType.Flora; StartSearch(); targetPreferenceFound = true; break; } } } if (targetPreferenceFound != true) { priorityTarget = consumeTarget[0]; currentTargetType = targetType.Terra; StartSearch(); } } break; case Diet.Carnivorous: if (thirst < baseHydration / 3) { priorityTarget = consumeTarget[2]; currentTargetType = targetType.Water; StartSearch(); } else { if (possibleTargets != null) { foreach (Transform posibleTarget in possibleTargets) { if (posibleTarget.GetComponent <AnimatEssence>() == true) { //Debug.Log("Essence in proximity"); priorityTarget = consumeTarget[3]; currentTargetType = targetType.Essence; StartSearch(); targetPreferenceFound = true; break; } } } if (targetPreferenceFound != true && hunger < baseSatation / 2) { priorityTarget = combatTarget; currentTargetType = targetType.Mob; StartSearch(); } } break; case Diet.Omnivorous: if (thirst < baseHydration / 2) { priorityTarget = consumeTarget[2]; currentTargetType = targetType.Water; StartSearch(); } else if (hunger < baseSatation / 3) { priorityTarget = consumeTarget[0]; currentTargetType = targetType.Terra; StartSearch(); } else if (hunger < baseSatation / 1.1) { if (possibleTargets != null) { foreach (Transform posibleTarget in possibleTargets) { if (posibleTarget.GetComponent <AnimatEssence>() == true) { priorityTarget = consumeTarget[3]; currentTargetType = targetType.Essence; StartSearch(); targetPreferenceFound = true; break; } } if (targetPreferenceFound != true) { foreach (Transform posibleTarget in possibleTargets) { if (posibleTarget.GetComponentInParent <PrimaryProducer>() == true) { priorityTarget = consumeTarget[1]; currentTargetType = targetType.Flora; StartSearch(); targetPreferenceFound = true; break; } } } } } break; } break; case State.Chasing: break; case State.Seaking: if ((thirst == baseHydration && currentTargetType == targetType.Water) || (hunger == baseSatation && currentTargetType == targetType.Terra)) { clearPrioritys(); } break; case State.Grazing: if ((thirst > baseHydration / 1.01 && currentTargetType == targetType.Water) || (hunger > baseSatation / 1.01 && currentTargetType == targetType.Terra) || hunger == baseSatation && currentTargetType == targetType.Essence) { clearPrioritys(); } break; case State.Nesting: Nest(); break; default: break; } yield return(new WaitForSeconds(0.25f)); } }