//Checks to see if the axe has been picked up public override bool checkComplete(GOAPAgent agent) { var anim = agent.GetComponentInChildren <Animator>(); if (agent.Target != null) { if (anim.GetBool("hasPickedUp")) { var controller = agent.GetComponentInParent <PlayerController>(); if (controller != null) { controller.SetHandObject(agent.Target); } anim.SetBool("hasPickedUp", false); return(true); } else { return(false); } } else { return(false); } }
public override void onActivation(GOAPAgent agent) { var anim = agent.GetComponentInChildren <Animator>(); if (anim == null) { Debug.Log("Animator doesn't exist"); } else { anim.SetTrigger("tr_pickup"); } }
//This script checks if the agent has destroyed the tree it was assigned to chop public override bool checkComplete(GOAPAgent agent) { var anim = agent.GetComponentInChildren <Animator>(); if (anim.GetBool("attack")) { if (agent.Target == null) { anim.SetBool("attack", false); return(true); } else { return(false); } } return(false); }
//This script checks to see if the firewood is still available public override bool checkComplete(GOAPAgent agent) { var anim = agent.GetComponentInChildren <Animator>(); int _playerAttackStateHash = Animator.StringToHash("Base Layer.interact"); if (agent.Target != null) { if (anim.GetBool("hasPickedUp")) { Destroy(agent.Target.gameObject); anim.SetBool("hasPickedUp", false); return(true); } else { return(false); } } else { return(false); } }