コード例 #1
0
 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);
     }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
    // Use this for initialization
    protected void Start()
    {
        base.Start();

        agent = GetComponent <NavMeshAgent>();
        if (agent == null)
        {
            Debug.LogError("need Component NavMeshAgent");
        }

        monAnimationCon = animationCon as MonsterAnimationController;
        if (monAnimationCon == null)
        {
            Debug.LogError("need Component MonsterAnimationController");
        }

        monAnimationCon.SetAttackSpeed(attackSpeed);
        monAnimationCon.SetMoveSpeed(moveSpeed);
        agent.speed = moveSpeed;

        currenthp = maxhp;

        state = MovetionState.IDLE;

        currentSkillID = UnityEngine.Random.Range(0, skills.Length);

        bloodChangeEvent.Invoke(currenthp / maxhp);

        SmallMap.Instance.AddMonsterIcon(gameObject);

        if (showEffect != null)
        {
            Instantiate(showEffect, transform.position, transform.rotation);
        }
    }
コード例 #4
0
 public override void Execute(GoapAgent agent)
 {
     if (monsterAnimationController == null)
     {
         monsterAnimationController = agent.GetComponent <MonsterAnimationController>();
     }
     monsterAnimationController.attacking = true;
     if (!ActionPossible(agent))
     {
         monsterAnimationController.attacking = false;
         Fail(agent);
     }
     else if (agent.state["gcdReady"].Equals(true))
     {
         ApplyEffects(agent);
     }
 }
コード例 #5
0
 public override void Execute(GoapAgent agent)
 {
     if (monsterAnimationController == null)
     {
         monsterAnimationController = agent.GetComponent <MonsterAnimationController>();
     }
     if (!ActionPossible(agent))
     {
         FailAction(agent);
         return;
     }
     if (!started)
     {
         StartAction(agent);
     }
     ContinueAction(agent);
 }
コード例 #6
0
 public override void Execute(GoapAgent agent)
 {
     if (monsterAnimationController == null)
     {
         monsterAnimationController = agent.GetComponent <MonsterAnimationController>();
     }
     if (boss == null)
     {
         boss = agent.GetComponent <Boss>();
     }
     if (!ActionPossible(agent))
     {
         Fail(agent);
     }
     else
     {
         UseAbility(agent);
     }
 }