public override TaskStatus OnUpdate() { if (PerformAction.Value) { return(TaskStatus.Success); } if (PerformanceTimer.Value >= 0f) { PerformanceTimer.Value -= Time.deltaTime; } else { PerformAction.SetValue(true); PerformanceTimer.Value = Random.Range(MinTimer.Value, MaxTimer.Value); } return(TaskStatus.Running); }
/// <summary> /// Make the agent pay attention /// </summary> public void PayAttention() { var agentPAMScript = GetComponent <AgentPredictiveAvoidanceModel> (); currentAttentiveness = 1.0f; agentPAMScript.SetAttentiveness(currentAttentiveness, false); isDistracted = false; SetTarget(target); isDistractedBehaviorTree.SetValue(isDistracted); behaviorTree.SetVariableValue("makeStopAndText", false); attentiveState = "Paying Attention"; var sprites = GetComponentsInChildren <SpriteRenderer>(); for (int i = 0; i < sprites.Length; i++) { sprites [i].enabled = false; } }