Ejemplo n.º 1
0
 public void ModifierOverrideAreaAffectsSelf()
 {
     this.modifier.area         = 4;
     this.modifier.overrideArea = true;
     this.surface.BuildNavMesh();
     Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(16, 0));
 }
Ejemplo n.º 2
0
 public void BuildUsesOnlyIncludedLayers()
 {
     this.plane.set_layer(4);
     this.surface.layerMask = LayerMask.op_Implicit(-17);
     this.surface.BuildNavMesh();
     Assert.IsFalse(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
 }
 public void AreaDoesNotAffectsNavMeshWhenNotOverlapping()
 {
     this.modifier.center = Vector3.op_Multiply(1.1f, Vector3.get_right());
     this.modifier.size   = Vector3.get_one();
     this.modifier.area   = 4;
     this.surface.BuildNavMesh();
     Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(1, 0));
 }
 public void AreaAffectsNavMeshOverlapping()
 {
     this.modifier.center = Vector3.get_zero();
     this.modifier.size   = Vector3.get_one();
     this.modifier.area   = 4;
     this.surface.BuildNavMesh();
     Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(16, 0));
 }
Ejemplo n.º 5
0
 public void BuildIgnoresGeometryOutsideBounds()
 {
     this.surface.collectObjects = CollectObjects.Volume;
     this.surface.center         = new Vector3(20f, 0.0f, 0.0f);
     this.surface.size           = new Vector3(10f, 10f, 10f);
     this.surface.BuildNavMesh();
     Assert.IsFalse(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
 }
    public void ModifierIgnoreAffectsSelf()
    {
        modifier.ignoreFromBuild = true;

        surface.BuildNavMesh();

        Assert.IsFalse(NavMeshSurfaceTests.HasNavMeshAtOrigin());
    }
Ejemplo n.º 7
0
 public void NavMeshIsNotAvailableWhenDisabled()
 {
     this.surface.BuildNavMesh();
     ((Behaviour)this.surface).set_enabled(false);
     Assert.IsFalse(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
     ((Behaviour)this.surface).set_enabled(true);
     Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
 }
Ejemplo n.º 8
0
    public void CanBuildWithCustomArea()
    {
        this.surface.defaultArea = 4;
        int areaMask = 16;

        this.surface.BuildNavMesh();
        Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(areaMask, 0));
    }
Ejemplo n.º 9
0
 public void NavMeshCanBeRemovedAndAdded()
 {
     this.surface.BuildNavMesh();
     Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
     this.surface.RemoveData();
     Assert.IsFalse(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
     this.surface.AddData();
     Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
 }
Ejemplo n.º 10
0
 public void CanBuildRenderMeshesAndIgnoreColliders()
 {
     ((Collider)this.plane.GetComponent <Collider>()).set_enabled(false);
     this.surface.useGeometry = (NavMeshCollectGeometry)1;
     this.surface.BuildNavMesh();
     Assert.IsFalse(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
     this.surface.useGeometry = (NavMeshCollectGeometry)0;
     this.surface.BuildNavMesh();
     Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
 }
 public void BuildUsesOnlyIncludedModifierVolume()
 {
     this.modifier.center = Vector3.get_zero();
     this.modifier.size   = Vector3.get_one();
     this.modifier.area   = 4;
     ((Component)this.modifier).get_gameObject().set_layer(7);
     this.surface.layerMask = LayerMask.op_Implicit(-129);
     this.surface.BuildNavMesh();
     Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(1, 0));
 }
Ejemplo n.º 12
0
    public void ModifierIgnoreDoesNotAffectSibling()
    {
        this.modifier.ignoreFromBuild = true;
        ((Renderer)((Component)this.modifier).GetComponent <MeshRenderer>()).set_enabled(false);
        GameObject primitive = GameObject.CreatePrimitive((PrimitiveType)4);

        this.surface.BuildNavMesh();
        Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
        Object.DestroyImmediate((Object)primitive);
    }
    public void ModifierOverrideAreaAffectsSelf()
    {
        modifier.area         = 4;
        modifier.overrideArea = true;

        surface.BuildNavMesh();

        var expectedAreaMask = 1 << 4;

        Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(expectedAreaMask));
    }
Ejemplo n.º 14
0
    public void ModifierIgnoreAffectsChild()
    {
        this.modifier.ignoreFromBuild = true;
        ((Renderer)((Component)this.modifier).GetComponent <MeshRenderer>()).set_enabled(false);
        GameObject primitive = GameObject.CreatePrimitive((PrimitiveType)4);

        primitive.get_transform().SetParent(((Component)this.modifier).get_transform());
        this.surface.BuildNavMesh();
        Assert.IsFalse(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
        Object.DestroyImmediate((Object)primitive);
    }
    public void ModifierIgnoreDoesNotAffectSibling()
    {
        modifier.ignoreFromBuild = true;
        modifier.GetComponent <MeshRenderer>().enabled = false;

        var siblingPlane = GameObject.CreatePrimitive(PrimitiveType.Plane);

        surface.BuildNavMesh();

        Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin());
        GameObject.DestroyImmediate(siblingPlane);
    }
    public void AreaAffectsNavMeshOverlapping()
    {
        modifier.center = Vector3.zero;
        modifier.size   = Vector3.one;
        modifier.area   = 4;

        surface.BuildNavMesh();

        var expectedAreaMask = 1 << 4;

        Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(expectedAreaMask));
    }
    public void AreaDoesNotAffectsNavMeshWhenNotOverlapping()
    {
        modifier.center = 1.1f * Vector3.right;
        modifier.size   = Vector3.one;
        modifier.area   = 4;

        surface.BuildNavMesh();

        var expectedAreaMask = 1;

        Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(expectedAreaMask));
    }
    public void ModifierIgnoreAffectsSelf()
    {
        var go       = GameObject.CreatePrimitive(PrimitiveType.Plane);
        var surface  = go.AddComponent <NavMeshSurface>();
        var modifier = go.AddComponent <NavMeshModifier>();

        modifier.ignoreFromBuild = true;

        surface.BuildNavMesh();

        Assert.IsFalse(NavMeshSurfaceTests.HasNavMeshAtOrigin());
        GameObject.DestroyImmediate(go);
    }
    public void BuildUsesOnlyIncludedModifierVolume()
    {
        modifier.center           = Vector3.zero;
        modifier.size             = Vector3.one;
        modifier.area             = 4;
        modifier.gameObject.layer = 7;

        surface.layerMask = ~(1 << 7);
        surface.BuildNavMesh();

        var expectedAreaMask = 1;

        Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(expectedAreaMask));
    }
    public void ModifierIgnoreAffectsChild()
    {
        modifier.ignoreFromBuild = true;
        modifier.GetComponent <MeshRenderer>().enabled = false;

        var childPlane = GameObject.CreatePrimitive(PrimitiveType.Plane);

        childPlane.transform.SetParent(modifier.transform);

        surface.BuildNavMesh();

        Assert.IsFalse(NavMeshSurfaceTests.HasNavMeshAtOrigin());
        GameObject.DestroyImmediate(childPlane);
    }
    public void ModifierOverrideAreaDoesNotAffectSibling()
    {
        modifier.area         = 4;
        modifier.overrideArea = true;
        modifier.GetComponent <MeshRenderer>().enabled = false;

        var siblingPlane = GameObject.CreatePrimitive(PrimitiveType.Plane);

        surface.BuildNavMesh();

        var expectedAreaMask = 1;

        Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(expectedAreaMask));
        GameObject.DestroyImmediate(siblingPlane);
    }
    public void ModifierOverrideAreaAffectsSelf()
    {
        var go       = GameObject.CreatePrimitive(PrimitiveType.Plane);
        var surface  = go.AddComponent <NavMeshSurface>();
        var modifier = go.AddComponent <NavMeshModifier>();

        modifier.area         = 4;
        modifier.overrideArea = true;

        surface.BuildNavMesh();

        var expectedAreaMask = 1 << 4;

        Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(expectedAreaMask));
        GameObject.DestroyImmediate(go);
    }
    public void ModifierOverrideAreaAffectsChild()
    {
        modifier.area         = 4;
        modifier.overrideArea = true;
        modifier.GetComponent <MeshRenderer>().enabled = false;

        var childPlane = GameObject.CreatePrimitive(PrimitiveType.Plane);

        childPlane.transform.SetParent(modifier.transform);

        surface.BuildNavMesh();

        var expectedAreaMask = 1 << 4;

        Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(expectedAreaMask));
        GameObject.DestroyImmediate(childPlane);
    }
    public void ModifierIgnoreAffectsChild()
    {
        var go       = new GameObject();
        var surface  = go.AddComponent <NavMeshSurface>();
        var modifier = go.AddComponent <NavMeshModifier>();

        modifier.ignoreFromBuild = true;

        var plane = GameObject.CreatePrimitive(PrimitiveType.Plane);

        plane.transform.SetParent(modifier.transform);

        surface.BuildNavMesh();

        Assert.IsFalse(NavMeshSurfaceTests.HasNavMeshAtOrigin());
        GameObject.DestroyImmediate(go);
        GameObject.DestroyImmediate(plane);
    }
    public void AreaAffectsNavMeshOverlapping()
    {
        var go       = GameObject.CreatePrimitive(PrimitiveType.Plane);
        var surface  = go.AddComponent <NavMeshSurface>();
        var modifier = go.AddComponent <NavMeshModifierVolume>();

        modifier.center = Vector3.zero;
        modifier.size   = Vector3.one;
        modifier.area   = 4;

        surface.BuildNavMesh();

        var expectedAreaMask = 1 << 4;

        Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(expectedAreaMask));

        GameObject.DestroyImmediate(go);
    }
    public void BuildUsesOnlyIncludedModifierVolume()
    {
        var go      = GameObject.CreatePrimitive(PrimitiveType.Plane);
        var surface = go.AddComponent <NavMeshSurface>();

        var modifierGO = new GameObject();
        var modifier   = modifierGO.AddComponent <NavMeshModifierVolume>();

        modifier.center  = Vector3.zero;
        modifier.size    = Vector3.one;
        modifier.area    = 4;
        modifierGO.layer = 7;

        surface.layerMask = ~(1 << 7);
        surface.BuildNavMesh();

        var expectedAreaMask = 1;

        Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(expectedAreaMask));

        GameObject.DestroyImmediate(go);
        GameObject.DestroyImmediate(modifierGO);
    }
Ejemplo n.º 27
0
 public void CreatePlaneWithSurface()
 {
     this.plane   = GameObject.CreatePrimitive((PrimitiveType)4);
     this.surface = (NavMeshSurface) new GameObject().AddComponent <NavMeshSurface>();
     Assert.IsFalse(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
 }
Ejemplo n.º 28
0
 public void DestroyPlaneWithSurface()
 {
     Object.DestroyImmediate((Object)this.plane);
     Object.DestroyImmediate((Object)((Component)this.surface).get_gameObject());
     Assert.IsFalse(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
 }
Ejemplo n.º 29
0
 public void NavMeshIsAvailableAfterBuild()
 {
     this.surface.BuildNavMesh();
     Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 0));
 }
Ejemplo n.º 30
0
 public void CanBuildWithCustomAgentTypeID()
 {
     this.surface.agentTypeID = 1234;
     this.surface.BuildNavMesh();
     Assert.IsTrue(NavMeshSurfaceTests.HasNavMeshAtOrigin(-1, 1234));
 }