Example #1
0
 private void FinishAttack()
 {
     if (melee.GetDistance(melee.player.transform.position) <= melee.distanceToChase)
     {
         melee.ChangeState(melee.chase);
     }
     if (melee.GetDistance(melee.player.transform.position) >= melee.distanceToChase)
     {
         melee.ChangeState(melee.patrol);
     }
 }
Example #2
0
    public override void Execute()
    {
        melee.enemy_navmesh.SetDestination(melee.player.transform.position);

        if (melee.GetDistance(melee.player.transform.position) >= melee.distanceToChase)
        {
            melee.ChangeState(melee.patrol);
        }
        if (melee.GetDistance(melee.player.transform.position) <= melee.distanceToAttack)
        {
            melee.ChangeState(melee.attack);
        }
    }
Example #3
0
    public override void Execute()
    {
        melee.enemy_navmesh.SetDestination(melee.player.transform.position);

        timer += Time.deltaTime;

        if (timer >= 1f)
        {
            if (melee.distanceToPlayer >= melee.distanceToChase)
            {
                melee.ChangeState(melee.patrol);
            }
            if (melee.distanceToPlayer <= melee.distanceToAttack)
            {
                melee.ChangeState(melee.prepAttack);
            }
        }
    }
Example #4
0
    public override void Execute()
    {
        timer += Time.deltaTime;

        if (timer >= timeStaggered)
        {
            if (melee.currentHealth > 0)
            {
                if (melee.distanceToPlayer <= melee.distanceToAttack)
                {
                    melee.ChangeState(melee.prepAttack);
                }

                else if (melee.distanceToPlayer <= melee.distanceToChase)
                {
                    melee.ChangeState(melee.chase);
                }
            }
        }
    }
Example #5
0
 public override void Execute()
 {
     if (melee.GetDistance(patrolPoint) < distanceToPoint)
     {
         AssignRandom();
     }
     if (melee.GetDistance(melee.player.transform.position) <= melee.distanceToChase)
     {
         melee.ChangeState(melee.chase);
     }
 }
    public override void Execute()
    {
        Quaternion lookOnLook = Quaternion.LookRotation(-melee.directionAttack);

        transform.rotation = Quaternion.Slerp(melee.enemy_navmesh.transform.rotation, lookOnLook, Time.deltaTime * 1.5f);


        timer += Time.deltaTime;

        if (timer > timeWaitAttack)
        {
            melee.ChangeState(melee.attack);
        }
    }