Esempio n. 1
0
    private static Vector2 AvoidWalls(Copter copter, TunnelArena myArena, float repulsionMagnitude, float repulsionRadius)
    {
        Vector2 movementVector = new Vector2(0.0f, 0.0f);

        foreach (WallElement wall in myArena.AllWalls)
        {
            CollisionResult cr = copter.PolygonCircleCollision(wall.CornerPoints);
            movementVector += SwarmingFormulas.RepelWhenClose(cr.CollisionPointThisObject, cr.CollisionPointOtherObject, repulsionMagnitude, repulsionRadius);
        }
        return(movementVector);
    }
Esempio n. 2
0
    public static Vector2 RepelWhenClose(Copter thisCopter, WallElement wall, float repulsionMagnitude, float repulsionRadius)
    {
        CollisionResult cr = thisCopter.PolygonCircleCollision(wall.CornerPoints);

        return(RepelWhenClose(thisCopter, cr.CollisionPointOtherObject, repulsionMagnitude, repulsionRadius));
    }