protected override void OnExecute() { if (gameObject.value == null) { Debug.LogError("You did not assign any object!"); return; } iObject = gameObject.value.GetComponent <InteractiveObjectBT>(); if (iObject == null) { Debug.LogError("Agent can only interact with objects with behaviour trees: " + gameObject.value.name); return; } if (disablePushing) { radius = agent.GetComponent <UnityEngine.AI.NavMeshAgent>().radius; agent.GetComponent <UnityEngine.AI.NavMeshAgent>().radius = 0; } // start the coroutine StartCoroutine(iObject.InteractWithObject(agent.gameObject, null, action.value, forceTransform, animationState, Finish)); base.OnExecute(); }
protected override bool Success() { if (!startInteraction) { return(true); } if (disablePushing) { radius = agent.GetComponent <UnityEngine.AI.NavMeshAgent>().radius; agent.GetComponent <UnityEngine.AI.NavMeshAgent>().radius = 0; } // start the coroutine StartCoroutine(iObject.InteractWithObject(agent.gameObject, this.currentTarget, action.value, forcePosition, animationState, Finish)); return(false); }