Ejemplo n.º 1
0
    bool CheckMovement(Vector3 direction)
    {
        // quick fix to get around seeming inaccuracies in float comparison
        float   eps    = 0.05f;
        float   limit  = LevelController.Instance.worldSettings.worldExtent + eps;
        Vector3 target = transform.position + direction;

        if (Mathf.Abs(target.x) >= limit || Mathf.Abs(target.y) >= limit || Mathf.Abs(target.z) >= limit)
        {
            return(false);
        }
        if (InputHandler.AreAnyCubesAtPosition(target, eps, this))
        {
            return(false);
        }
        return(true);
    }