Example #1
0
    public override void OnMove(GameObject player)
    {
        state = EnemyState.MOVE;
        animator.SetBool("movement", true);
        Vector2 vec = player.transform.position - transform.position;

        if (vec.x > 0)
        {
            controllerMovement.AddIntent(new Intent(Intent.Type.H_MOVE_RIGHT));
        }
        else
        {
            controllerMovement.AddIntent(new Intent(Intent.Type.H_MOVE_LEFT));
        }
    }
Example #2
0
    public override void OnMove(GameObject player)
    {
        if (state == EnemyState.ATACK || state == EnemyState.NONE)
        {
            return;
        }

        animator.SetBool("isMov", true);
        Vector2 vec = player.transform.position - transform.position;

        if (vec.x > 0)
        {
            controllerMovement.AddIntent(new Intent(Intent.Type.H_MOVE_RIGHT));
        }
        else
        {
            controllerMovement.AddIntent(new Intent(Intent.Type.H_MOVE_LEFT));
        }
    }