public override NodeState Evaluate() { Vector3 closerBase = (Vector3)blackboard.GetValue("closerEnemyBase"); globalBlackboard.UpdateValue("currentEnemyBase", closerBase); globalBlackboard.UpdateValue("enemyBaseFound", true); return(NodeState.SUCCESS); }
public void OnValueChanged(string value) { if (value == "") { globalBlackboard.UpdateValue("totalNumberOfCharacters", 0); } else { int amount = int.Parse(value); amount = Mathf.Clamp(amount, 0, 100); field.text = amount.ToString(); globalBlackboard.UpdateValue("totalNumberOfCharacters", amount); } }
public override NodeState Evaluate() { if ((Vector3)blackboard.GetValue("currentFoodLocation") == Vector3.zero) { return(NodeState.SUCCESS); } if (isEating) { if (timer >= eatAnimationLength) { ObjectDestroyer.DestroyObjectAtGivenPosition((Vector3)blackboard.GetValue("currentFoodLocation"), LayerMask.GetMask("Food")); int foodEaten = (int)globalBlackboard.GetValue("foodEaten") + 1; globalBlackboard.UpdateValue("foodEaten", foodEaten); return(NodeState.SUCCESS); } else { timer += Time.deltaTime; } } else { anim.SetTrigger("Attack"); agent.isStopped = true; isEating = true; } return(NodeState.RUNNING); }
public override NodeState Evaluate() { int foodEaten = (int)globalBlackboard.GetValue("foodEaten"); float t = Mathf.InverseLerp(0, maxFood, foodEaten); float attackDamage = Mathf.Lerp(minAttackDamage, maxAttackDamage, t); globalBlackboard.UpdateValue("attackDamage", attackDamage); return(NodeState.SUCCESS); }
void ModifyCharactersNumberOnBlackboards() { int numberOfGlobalCharacters = (int)GameGlobalBlackboard.Instance.GetValue("totalNumberOfCharacters"); GameGlobalBlackboard.Instance.UpdateValue("totalNumberOfCharacters", numberOfGlobalCharacters - 1); int numberOfAllies = (int)globalBlackboard.GetValue("totalNumberOfCharacters"); globalBlackboard.UpdateValue("totalNumberOfCharacters", numberOfAllies - 1); }
public override bool EvaluateCondition() { if (baseManager.isBaseAlive((Vector3)globalBlackboard.GetValue("currentEnemyBase"))) { return(false); } globalBlackboard.UpdateValue("enemyBaseFound", false); return(true); }
void setInDanger(bool inDanger) { globalBlackboard.UpdateValue("baseIsInDanger", inDanger); imInDanger = inDanger; }
public override void OnStateEnter() { base.OnStateEnter(); globalBlackboard.UpdateValue("antsDefending", (int)globalBlackboard.GetValue("antsDefending") + 1); }
public override NodeState Evaluate() { globalBlackboard.UpdateValue("antsDefending", (int)globalBlackboard.GetValue("antsDefending") - 1); return(NodeState.SUCCESS); }