コード例 #1
0
    private void Chase()
    {
        attackDetector.gameObject.SetActive(true);
        // move in direction of player
        if (playerReference.transform.position.x >= transform.position.x)
        {
            entityMovement.MoveInDirection(1);
        }
        else
        {
            entityMovement.MoveInDirection(-1);
        }

        GameObject objectHit = raycastHelper.CheckForObjectHits();

        if (objectHit != null)
        {
            if (objectHit.tag == "Ground")
            {
                entityMovement.Jump();
            }
        }
        else if (groundedController.GetIsGrounded() &&
                 raycastHelper.CheckForLedges() &&
                 playerReference.transform.position.y > transform.root.position.y)
        {
            entityMovement.Jump();
        }
    }