Example #1
0
 public override NodeState Evaluate()
 {
     currentTrapPos = (Vector3)blackboard.GetValue("currentTrapPointLocation");
     if (currentTrapPos == Vector3.zero || currentTrapPos != agent.destination)
     {
         return(NodeState.FAIL);
     }
     if (isSettingTrap)
     {
         if (timer >= attackAnimationLength)
         {
             GameObject spiderWeb = objectPooler.SpawnObject("SpiderWeb", currentTrapPos);
             TransformUtilities.RotateObjectPerpendicularToTheGround(spiderWeb.transform, groundLayerMask);
             spiderWebsManagement.SetPointAsUsed(currentTrapPos);
             return(NodeState.SUCCESS);
         }
         else
         {
             timer += Time.deltaTime;
         }
     }
     else
     {
         anim.SetTrigger("Attack");
         agent.isStopped = true;
         isSettingTrap   = true;
     }
     return(NodeState.RUNNING);
 }
 void rotateBase(Transform myBase)
 {
     TransformUtilities.RotateObjectPerpendicularToTheGround(myBase, groundLayer);
 }