private void ContinueAction(GoapAgent agent)
 {
     if (monsterAnimationController == null)
     {
         monsterAnimationController = agent.GetComponent <MonsterAnimationController>();
     }
     if (monsterBaseAbilities == null)
     {
         monsterBaseAbilities = agent.GetComponent <MonsterBaseAbilities>();
     }
     if (abilityUser == null)
     {
         abilityUser = agent.GetComponent <AbilityUser>();
     }
     if (!ActionPossible(agent))
     {
         monsterAnimationController.attacking = false;
     }
     else
     {
         monsterAnimationController.attacking = true;
         HitPlayer(agent);
     }
     timer += Time.deltaTime;
     agent.transform.rotation = Quaternion.Slerp(originalRotation, targetLookRotation, timer / turnTime);
     if (timer >= turnTime)
     {
         timer   = 0f;
         started = false;
         ApplyEffects(agent);
     }
 }
 public override void Execute(GoapAgent agent)
 {
     if (monsterAnimationController == null)
     {
         monsterAnimationController = agent.GetComponent <MonsterAnimationController>();
     }
     if (monsterBaseAbilities == null)
     {
         monsterBaseAbilities = agent.GetComponent <MonsterBaseAbilities>();
     }
     if (abilityUser == null)
     {
         abilityUser = agent.GetComponent <AbilityUser>();
     }
     if (!ActionPossible(agent))
     {
         monsterAnimationController.attacking = false;
         Fail(agent);
     }
     else
     {
         monsterAnimationController.attacking = true;
         HitPlayer(agent);
     }
 }
Beispiel #3
0
 public override void Run(GoapAgent agent)
 {
     if (abilityUser == null)
     {
         abilityUser = agent.GetComponent <AbilityUser>();
     }
     if (monsterBaseAbilities == null)
     {
         monsterBaseAbilities = agent.GetComponent <MonsterBaseAbilities>();
     }
     agent.state["meleeAttackAvailable"]  = IsMeleeAttackAvailable();
     agent.state["rangedAttackAvailable"] = IsRangedAttackAvailable();
 }